Re: Should a plan node's result tuple slot be read-only to caller? - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Should a plan node's result tuple slot be read-only to caller?
Date
Msg-id 20051114153226.GD15381@svana.org
Whole thread Raw
In response to Should a plan node's result tuple slot be read-only to caller?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Nov 14, 2005 at 10:14:53AM -0500, Tom Lane wrote:
> The minimum-change way to fix the bug would be to revert the logic
> change in nodeUnique.c and go back to maintaining a separate tuple copy.
> But I'm thinking that this sort of thing could happen again.  ISTM
> it's not intuitive to allow a plan node's caller to scribble on the plan
> node's result slot.  An alternative solution would be to require
> execMain.c to keep an extra tuple table slot that has no other purpose
> than to temporarily hold replacement tuples during ExecInsert and
> ExecUpdate.

I agree that execMain should play with its own memory. The rule that a
node's result slot is valid until the next call is good because it
solves the memory management issue. By allowing other people to
scribble over your slot may cause issues w.r.t. knowing when you can
safely free it.

From a modularity point of view, nodes own their tupleslots and should
be able to rely on them not changing...

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: 8.0 -> 8.1 dump duplicate key problem?
Next
From: Tom Lane
Date:
Subject: Re: outer joins and for update