Re: [HACKERS] ExecInitAppend - Mailing list pgsql-hackers

From Chris Bitmead
Subject Re: [HACKERS] ExecInitAppend
Date
Msg-id 389F9FBC.FB352F00@nimrod.itg.telecom.com.au
Whole thread Raw
In response to ExecInitAppend  (Chris Bitmead <chrisb@nimrod.itg.telstra.com.au>)
List pgsql-hackers
Tom Lane wrote:
> 
> Chris Bitmead <chrisb@nimrod.itg.telstra.com.au> writes:
> > In ExecInitAppend it initialises all the subplans...
> > And then at the end of the function, it initialises the first plan
> > again...
> > Is this code correct? Should the first plan really be initialised twice?
> 
> Probably not --- I imagine that's wasting memory, or worse.  Do things
> still work if you remove the extra initialize call?

This code looks ugly because it sets appendstate->as_whichplan so that
exec_append_initialise_next knows which plan it's supposed to initialise
-
yucky side effect.

I suspect it will stop working if the last call is removed because it
*may*
be relying on the first plan to be initialised last, so that the estate
variables are initialised to the first plan. It may work if the plans
are initialised in reverse order, but the right way is probably to 
reorganise the code.


pgsql-hackers by date:

Previous
From: Chris Bitmead
Date:
Subject: Is this it?
Next
From: Chris Bitmead
Date:
Subject: Re: [HACKERS] Is this it?