*/
ProcessCopyOptions(NULL, true, other_options);
+ /*
+ * Filename option is required for file_fdw foreign tables.
+ */
+ if (catalog == ForeignTableRelationId && filename == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED),
+ errmsg("filename is required for file_fdw foreign tables")));
+
PG_RETURN_VOID();
}
}
prev = lc;
}
+
+ /*
+ * The validator should have checked that a filename was included in the
+ * options, but check again, just in case.
+ */
if (*filename == NULL)
- ereport(ERROR,
- (errcode(ERRCODE_FDW_UNABLE_TO_CREATE_REPLY),
- errmsg("filename is required for file_fdw foreign tables")));
+ elog(ERROR, "filename is required for file_fdw foreign tables");
+
*other_options = options;
}
'); -- ERROR
CREATE FOREIGN TABLE tbl () SERVER file_server OPTIONS (format 'csv', null '
'); -- ERROR
+CREATE FOREIGN TABLE tbl () SERVER file_server; -- 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; -- ERROR
+ERROR: filename is required for file_fdw foreign tables
CREATE FOREIGN TABLE agg_text (
a int2,
b float4