Re: Question about tuplestore clients

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about tuplestore clients
Date: 2007-03-20 17:23:50
Message-ID: 15297.1174411430@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-03-20 17:25:23 Re: Patch for pg_dump
Previous Message Martijn van Oosterhout 2007-03-20 17:20:43 Re: Buildfarm feature request: some way to track/classify failures