Re: Question about tuplestore clients - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question about tuplestore clients
Date
Msg-id 15297.1174411430@sss.pgh.pa.us
Whole thread Raw
In response to Question about tuplestore clients  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> However I've run into something I didn't expect. It seems merge joins keep a
> reference to a tuple *after* they set the mark beyond it. I'm trying to figure
> out why this is necessary but I haven't absorbed all of nodeMergejoin yet.

I think at the instant that ExecMarkPos is called, there are likely to
still be tuple slots holding references to the previously marked tuple.
It might work if you swap the two lines
                   ExecMarkPos(innerPlan);
                   MarkInnerTuple(node->mj_InnerTupleSlot, node);

However, the whole thing sounds a bit fragile.  If tuplestore_gettuple
returns a tuple with shouldfree = false, I think you had better assume
that that tuple can be referenced until after the next
tuplestore_gettuple call, independently of mark/restore calls.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Buildfarm feature request: some way to track/classify failures
Next
From: Tom Lane
Date:
Subject: Re: Patch for pg_dump