Re: RangeTblEntry.inh vs. RTE_SUBQUERY

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: RangeTblEntry.inh vs. RTE_SUBQUERY
Date: 2024-03-07 15:56:13
Message-ID: bf38f301-074f-4ead-9f85-1722d2313ce9@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03.03.24 11:02, Peter Eisentraut wrote:
> On 29.02.24 19:14, Tom Lane wrote:
>> Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>>> In nodes/parsenodes.h, it says both
>>>       This *must* be false for RTEs other than RTE_RELATION entries.
>>
>> Well, that's true in the parser ...
>>
>>> 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.
>>
>> Dunno.  The adjacent "lateral" field is also used for only selected
>> RTE kinds.
>
> The section is
>
>     /*
>      * Fields valid in all RTEs:
>      */
>     Alias      *alias;          /* user-written alias clause, if any */
>     Alias      *eref;           /* expanded reference names */
>     bool        lateral;        /* subquery, function, or values is
> LATERAL? */
>     bool        inh;            /* inheritance requested? */
>     bool        inFromCl;       /* present in FROM clause? */
>     List       *securityQuals;  /* security barrier quals to apply, if
> any */
>
> According to my testing, lateral is used for RTE_RELATION, RTE_SUBQUERY,
> RTE_FUNCTION, RTE_TABLEFUNC, RTE_VALUES, which is 5 out of 9 possible.
> So I think it might be okay to relabel that section (in actuality or
> mentally) as "valid in several/many/most RTEs".
>
> But I'm not sure what reason there would be for having inh there, which
> is better described as "valid for RTE_RELATION, but also borrowed by
> RTE_SUBQUERY", which is pretty much exactly what is the case for relid,
> relkind, etc.

I have committed the patches for this discussion.

Related discussion will continue at
https://www.postgresql.org/message-id/flat/4b27fc50-8cd6-46f5-ab20-88dbaadca645(at)eisentraut(dot)org
/ https://commitfest.postgresql.org/47/4697/ .

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-03-07 16:08:35 Re: improve ssl error code, 2147483650
Previous Message Benoit Tigeot 2024-03-07 15:41:55 Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan