[ not directly related to your bug, but... ]
"Pavel Stehule" <pavel.stehule@gmail.com> writes:
> result = ExecutorRun(qdesc, ForwardScanDirection, 1L);
> tuple = ExecMaterializeSlot(result);
> values = (Datum *) palloc(nargs * sizeof(Datum));
> nulls = (char *) palloc(nargs * sizeof(char));
> /* copy typle to current context */
> tuple = heap_copytuple(tuple);
> heap_deform_tuple(tuple, qdesc->tupDesc, values, nulls);
Surely that's the hard way, considering that the output tupleslot is
probably *already* a values/nulls array. Use slot_getattr(), or call
slot_getallattrs() and then reference the slot's arrays directly.
regards, tom lane