Re: strange tuple from ExecutorRun - Mailing list pgsql-hackers

From Tom Lane
Subject Re: strange tuple from ExecutorRun
Date
Msg-id 13367.1195230143@sss.pgh.pa.us
Whole thread Raw
In response to strange tuple from ExecutorRun  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List pgsql-hackers
[ 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


pgsql-hackers by date:

Previous
From: Sam Mason
Date:
Subject: Re: Javascript support in the backend, i.e. PL/JS
Next
From: Tom Lane
Date:
Subject: Re: AllocSetStats uses fprintf instead of elog