Re: RangeTblEntry.inh vs. RTE_SUBQUERY

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RangeTblEntry.inh vs. RTE_SUBQUERY
Date: 2024-02-29 12:58:21
Message-ID: 54faad3d-d604-4ef6-9e78-b055861f54cd@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.02.24 16:19, Tom Lane wrote:
> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
>> On Fri, 23 Feb 2024 at 14:35, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>>> Various code comments say that the RangeTblEntry field inh may only be
>>> set for entries of kind RTE_RELATION.
>
>> Yes, it's explained a bit more clearly/accurately in expand_inherited_rtentry():
>
>> * "inh" is only allowed in two cases: RELATION and SUBQUERY RTEs.
>
> Yes. The latter has been accurate for a very long time, so I'm
> surprised that there are any places that think otherwise. We need
> to fix them --- where did you see this exactly?

In nodes/parsenodes.h, it says both

This *must* be false for RTEs other than RTE_RELATION entries.

and also puts it under

Fields valid in all RTEs:

which are both wrong on opposite ends of the spectrum.

I think it would make more sense to group inh under "Fields valid for a
plain relation RTE" and then explain the exception for subqueries, like
it is done for several other fields.

See attached patch for a proposal. (I also shuffled a few fields around
to make the order a bit more logical.)

Attachment Content-Type Size
0001-Fix-description-and-grouping-of-RangeTblEntry.inh.patch text/plain 8.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-02-29 13:14:20 Re: RangeTblEntry jumble omissions
Previous Message Tomas Vondra 2024-02-29 12:54:05 Re: BitmapHeapScan streaming read user and prelim refactoring