Re: Custom TupleTableSlotOps while Initializing Custom Scan
От | Ashutosh Bapat |
---|---|
Тема | Re: Custom TupleTableSlotOps while Initializing Custom Scan |
Дата | |
Msg-id | CAExHW5tFq_5F=NLLsmyBrnYLTjmN_q7RgrbMYxwZz8mxbeQgcQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Custom TupleTableSlotOps while Initializing Custom Scan (V N G Samba Siva Reddy Chinta <sambasivareddychinta@gmail.com>) |
Список | pgsql-hackers |
Hello Team,Good Day,I have been working on adding a
CustomScanState
object in the executor state in my project. As part ofCustomScanState
, I execute queries and store their results in theTuplestorestate
object. After storing all tuples in theTuplestorestate
, I retrieve each tuple and place it in theTupleTableSlot
using thetuplestore_gettupleslot()
function.However, I encounter an error: "trying to store a minimal tuple into the wrong type of slot." Upon debugging, I discovered that the
TupleTableSlot
only holds virtual tuples (tupleTableSlot->tts_ops
is set toTTSOpsVirtual
). In contrast,tuplestore_gettupleslot()
callsExecStoreMinimalTuple()
, which expectsTupleTableSlotOps
of typeTTSOpsMinimalTuple
.Further investigation revealed that in the
ExecInitCustomScan()
function within thenodeCustom.c
source file, whereScanTupleSlot
andResultTupleSlots
are initialized, users can choose custom slots by settingslotOps
inCustomScanState
. We initialize theScanTupleSlot
based on user-specifiedslotOps
, but forResultTupleSlot
, we proceed withTTSOpsVirtual
instead of the customslotOps
, which is causing the issue.
Is this behavior expected? Is there a way to store tuples in slots according to the
TupleTableSlot
type?
I found a function
ExecForceStoreMinimalTuple()
which can be used in my case. We need to pass the MinimalTuple to this function, but I was unable to find a way to fetch the tuple from tuple storestate. We do have
tuplestore_gettuple() function to get the minimal tuple but it is a static function, is there any other function like that?
В списке pgsql-hackers по дате отправления: