Merge pull request #717 from citusdata/fix-700

Skip over unreferenced parameters when router executing prepared statement.
pull/729/head
Andres Freund 2016-08-05 14:22:24 -07:00 committed by GitHub
commit 3ea352e5f9
1 changed files with 6 additions and 1 deletions

View File

@ -821,7 +821,12 @@ ExtractParametersFromParamListInfo(ParamListInfo paramListInfo, Oid **parameterT
(*parameterTypes)[parameterIndex] = parameterData->ptype;
}
if (parameterData->isnull)
/*
* If the parameter is NULL, or is not referenced / used (ptype == 0
* would otherwise have errored out inside standard_planner()),
* don't pass a value to the remote side.
*/
if (parameterData->isnull || parameterData->ptype == 0)
{
(*parameterValues)[parameterIndex] = NULL;
continue;