Re: setting estate in ExecInitNode() itself

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: setting estate in ExecInitNode() itself
Date: 2018-01-05 19:50:27
Message-ID: 20180105195027.3kv64hiipta2tqep@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-01-05 10:36:19 -0500, Tom Lane wrote:
> Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com> writes:
> > Looking at ExecInitXYZ() functions, we can observe that every such
> > function has a statement like
> > XYZstate->ps.state = estate;
> > where it saves estate in the PlanState.
>
> Yeah ...
>
> > I am wondering why don't we instead save estate in ExecInitNode() itself like
> > result->estate = estate;
>
> That would only work if there were no situation where the field needed to
> be already valid during the node init function. I think that's probably
> wrong already (check ExecInitExpr for instance) and it certainly might
> be wrong in future.

Agreed on that. But I also think there's quite some room for
centralizing some of the work done in the init routines. Not quite sure
how, but I do dislike the amount of repetition both in code and
comments.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-01-05 19:52:38 Re: Condition variable live lock
Previous Message Bruce Momjian 2018-01-05 19:49:48 Re: pgsql: pg_upgrade: simplify code layout in a few places