@@ -4967,11 +4967,14 @@ SetDataRowForIntParams(JunkFilter *junkfilter,
49674967{
49684968 StringInfoData buf ;
49694969 uint16 numparams = 0 ;
4970+ RemoteQuery * step = (RemoteQuery * ) rq_state -> ss .ps .plan ;
49704971
49714972 Assert (sourceSlot );
49724973
49734974 /* Calculate the total number of parameters */
4974- if (dataSlot )
4975+ if (step -> rq_max_param_num > 0 )
4976+ numparams = step -> rq_max_param_num ;
4977+ else if (dataSlot )
49754978 numparams = dataSlot -> tts_tupleDescriptor -> natts ;
49764979 /* Add number of junk attributes */
49774980 if (junkfilter )
@@ -5009,6 +5012,10 @@ SetDataRowForIntParams(JunkFilter *junkfilter,
50095012 {
50105013 TupleDesc tdesc = dataSlot -> tts_tupleDescriptor ;
50115014 int numatts = tdesc -> natts ;
5015+
5016+ if (step -> rq_max_param_num > 0 )
5017+ numatts = step -> rq_max_param_num ;
5018+
50125019 for (attindex = 0 ; attindex < numatts ; attindex ++ )
50135020 {
50145021 rq_state -> rqs_param_types [attindex ] =
@@ -5057,12 +5064,16 @@ SetDataRowForIntParams(JunkFilter *junkfilter,
50575064 {
50585065 TupleDesc tdesc = dataSlot -> tts_tupleDescriptor ;
50595066 int attindex ;
5067+ int numatts = tdesc -> natts ;
50605068
50615069 /* Append the data attributes */
50625070
5071+ if (step -> rq_max_param_num > 0 )
5072+ numatts = step -> rq_max_param_num ;
5073+
50635074 /* ensure we have all values */
50645075 slot_getallattrs (dataSlot );
5065- for (attindex = 0 ; attindex < tdesc -> natts ; attindex ++ )
5076+ for (attindex = 0 ; attindex < numatts ; attindex ++ )
50665077 {
50675078 uint32 n32 ;
50685079 Assert (attindex < numparams );
0 commit comments