Apply Albe's patch.
authorShigeru Hanada <shigeru.hanada@gmail.com>
Thu, 30 Jun 2011 05:41:57 +0000 (14:41 +0900)
committerShigeru Hanada <shigeru.hanada@gmail.com>
Fri, 1 Jul 2011 00:35:20 +0000 (09:35 +0900)
This patch makes validator functions to be called for every CREATE or
ALTER commands even if the option list was empty.

src/backend/commands/foreigncmds.c

index 21d52e06ba035fa095ce029e0fc5f49970c2d3ff..62afbe4af04eea6e2e175b194907928c4dd27344 100644 (file)
@@ -40,7 +40,7 @@
 /*
  * Convert a DefElem list to the text array format that is used in
  * pg_foreign_data_wrapper, pg_foreign_server, and pg_user_mapping.
- * Returns the array in the form of a Datum, or PointerGetDatum(NULL)
+ * Returns the array in the form of a Datum, an empty array
  * if the list is empty.
  *
  * Note: The array is usually stored to database without further
@@ -74,7 +74,7 @@ optionListToArray(List *options)
    if (astate)
        return makeArrayResult(astate, CurrentMemoryContext);
 
-   return PointerGetDatum(NULL);
+   return construct_empty_array(TEXTOID);
 }
 
 
@@ -165,7 +165,7 @@ transformGenericOptions(Oid catalogId,
 
    result = optionListToArray(resultOptions);
 
-   if (OidIsValid(fdwvalidator) && DatumGetPointer(result) != NULL)
+   if (OidIsValid(fdwvalidator))
        OidFunctionCall2(fdwvalidator, result, ObjectIdGetDatum(catalogId));
 
    return result;