mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
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.
This commit is contained in:
parent
457333d5c2
commit
c639d240c0
@ -165,8 +165,18 @@ transformGenericOptions(Oid catalogId,
|
|||||||
|
|
||||||
result = optionListToArray(resultOptions);
|
result = optionListToArray(resultOptions);
|
||||||
|
|
||||||
if (OidIsValid(fdwvalidator) && DatumGetPointer(result) != NULL)
|
if (OidIsValid(fdwvalidator))
|
||||||
OidFunctionCall2(fdwvalidator, result, ObjectIdGetDatum(catalogId));
|
{
|
||||||
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user