Before this fix, requirement of filename had been checked in
fileGetOptions() which is called by PlanForeignScan(). Now file_fdw can
check it in creation/alteration time.
*/
ProcessCopyOptions(NULL, true, other_options);
+ /*
+ * filename is a required option. Validity of other options including
+ * relative ones have been checked in ProcessCopyOptions().
+ * Note: We don't care its value even though it might be empty, because
+ * COPY comand doesn't.
+ */
+ if (catalog == ForeignTableRelationId && filename == NULL)
+ ereport(ERROR,
+ (errmsg("filename is required for file_fdw foreign tables")));
+
PG_RETURN_VOID();
}
'); -- ERROR
CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv', null '
'); -- ERROR
+CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv'); -- ERROR
CREATE FOREIGN TABLE agg_text (
a int2,
CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv', null '
'); -- ERROR
ERROR: COPY null representation cannot use newline or carriage return
+CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv'); -- ERROR
+ERROR: filename is required for file_fdw foreign tables
CREATE FOREIGN TABLE agg_text (
a int2,
b float4