Re: [HACKERS] ExecInitAppend

From: Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: chris(at)bitmead(dot)com, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] ExecInitAppend
Date: 2000-02-08 04:46:52
Message-ID: 389F9FBC.FB352F00@nimrod.itg.telecom.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> Chris Bitmead <chrisb(at)nimrod(dot)itg(dot)telstra(dot)com(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Bitmead 2000-02-08 04:52:05 Re: [HACKERS] Is this it?
Previous Message Tom Lane 2000-02-08 04:27:10 Re: [HACKERS] ExecInitAppend