aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-07-05 18:21:12 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-07-05 18:21:12 -0400
commit2e56fa863221d60d8bf8a8b946aaf8ba28ed05e7 (patch)
treed4756d0d32bbfc531a1cb0f6175bd2ea7ff8bbdb /src
parent9a0bdc8db5ceac574a2ae91cdf985499cd7c2b0c (diff)
downloadpostgresql-2e56fa863221d60d8bf8a8b946aaf8ba28ed05e7.tar.gz
postgresql-2e56fa863221d60d8bf8a8b946aaf8ba28ed05e7.zip
Call FDW validator functions even when the options list is empty.
This is useful since a validator might want to require certain options to be provided. The passed array is an empty text array in this case. Per suggestion by Laurenz Albe, though this is not quite his patch.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/foreigncmds.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 21d52e06ba0..643ba91bfe1 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -165,8 +165,18 @@ transformGenericOptions(Oid catalogId,
result = optionListToArray(resultOptions);
- if (OidIsValid(fdwvalidator) && DatumGetPointer(result) != NULL)
- OidFunctionCall2(fdwvalidator, result, ObjectIdGetDatum(catalogId));
+ if (OidIsValid(fdwvalidator))
+ {
+ Datum valarg = result;
+
+ /*
+ * Pass a null options list as an empty array, so that validators
+ * don't have to be declared non-strict to handle the case.
+ */
+ if (DatumGetPointer(valarg) == NULL)
+ valarg = PointerGetDatum(construct_empty_array(TEXTOID));
+ OidFunctionCall2(fdwvalidator, valarg, ObjectIdGetDatum(catalogId));
+ }
return result;
}