From: Shigeru Hanada Date: Thu, 30 Jun 2011 06:57:28 +0000 (+0900) Subject: Refactor requirement check of file_fdw. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=061e6f039beebc1d9527b35e210ffaf8bce874ed;p=users%2Fhanada%2Fpostgres.git Refactor requirement check of file_fdw. Until this fix, requirement of filename had been checked in fileGetOptions(), but it should just retrieve options from catalogs. So the check was moved into filePlanForeignScan(), where actually the option is required. There is no user-visible change. --- diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index a883f7551a..57e522fff3 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -296,10 +296,6 @@ fileGetOptions(Oid foreigntableid, } prev = lc; } - if (*filename == NULL) - ereport(ERROR, - (errcode(ERRCODE_FDW_UNABLE_TO_CREATE_REPLY), - errmsg("filename is required for file_fdw foreign tables"))); *other_options = options; } @@ -318,6 +314,10 @@ filePlanForeignScan(Oid foreigntableid, /* Fetch options --- we only need filename at this point */ fileGetOptions(foreigntableid, &filename, &options); + if (filename == NULL) + ereport(ERROR, + (errcode(ERRCODE_FDW_UNABLE_TO_CREATE_REPLY), + errmsg("filename is required for file_fdw foreign tables"))); /* Construct FdwPlan with cost estimates */ fdwplan = makeNode(FdwPlan);