public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: RangeTblEntry.inh vs. RTE_SUBQUERY
Date: Fri, 23 Feb 2024 15:34:56 +0100
Message-ID: <[email protected]> (raw)

Various code comments say that the RangeTblEntry field inh may only be 
set for entries of kind RTE_RELATION.

For example

  *    inh is true for relation references that should be expanded to 
include
  *    inheritance children, if the rel has any.  This *must* be false for
  *    RTEs other than RTE_RELATION entries.

and various comments in other files.

(Confusingly, it is also listed under "Fields valid in all RTEs:", but 
that definitely seems wrong.)

I have been deploying some assertions to see if the claims in the 
RangeTblEntry comments are all correct, and I tripped over something.

The function pull_up_simple_union_all() in prepjointree.c sets ->inh to 
true for RTE_SUBQUERY entries:

     /*
      * Mark the parent as an append relation.
      */
     rte->inh = true;

Whatever this is doing appears to be some undocumented magic.  If I 
remove the line, then regression tests fail with plan differences, so it 
definitely seems to do something.

Is this something we should explain the RangeTblEntry comments?






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: RangeTblEntry.inh vs. RTE_SUBQUERY
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox