Make sure to access PARAM_EXTERN accurately in PG 11

PG 11 has change the way that PARAM_EXTERN is processed.
This commit ensures that Citus follows the same pattern.

For details see the related Postgres commit:
6719b238e8
pull/2457/head
Onder Kalaci 2018-10-25 21:55:03 +03:00
parent c7891115ef
commit 9e2e2a7300
1 changed files with 13 additions and 5 deletions

View File

@ -1563,22 +1563,30 @@ HasUnresolvedExternParamsWalker(Node *expression, ParamListInfo boundParams)
/* check whether parameter is available (and valid) */
if (boundParams && paramId > 0 && paramId <= boundParams->numParams)
{
ParamExternData *externParam = &boundParams->params[paramId - 1];
Oid paramType = externParam->ptype;
ParamExternData *externParam = NULL;
Oid paramType = InvalidOid;
/* give hook a chance in case parameter is dynamic */
if (!OidIsValid(paramType) && boundParams->paramFetch != NULL)
if (boundParams->paramFetch != NULL)
{
#if (PG_VERSION_NUM >= 110000)
ParamExternData externParamPlaceholder;
externParam = (*boundParams->paramFetch)(boundParams, paramId, false,
&externParamPlaceholder);
#else
(*boundParams->paramFetch)(boundParams, paramId);
externParam = &boundParams->params[paramId - 1];
if (!OidIsValid(externParam->ptype))
{
(*boundParams->paramFetch)(boundParams, paramId);
}
#endif
paramType = externParam->ptype;
}
else
{
externParam = &boundParams->params[paramId - 1];
}
paramType = externParam->ptype;
if (OidIsValid(paramType))
{
return false;