mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Make the file_fdw validator check that a filename option has been provided.
This was already a runtime failure condition, but it's better to check at validation time if possible. Lightly modified version of a patch by Shigeru Hanada.
This commit is contained in:
@ -216,6 +216,14 @@ file_fdw_validator(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@ -287,10 +295,14 @@ fileGetOptions(Oid foreigntableid,
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user