public inbox for [email protected]  
help / color / mirror / Atom feed
From: Junwang Zhao <[email protected]>
To: Dmitry Nikitin <[email protected]>
Cc: [email protected]
Subject: Re: Unclear code - please elaborate
Date: Sat, 30 Nov 2024 19:54:35 +0800
Message-ID: <CAEG8a3L_4WJk7bHy7Lzy540Biqp=HZry1ghmgMVymOFkJrP2Dw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Sat, Nov 30, 2024 at 4:15 PM Dmitry Nikitin
<[email protected]> wrote:
>
> Hello ,
>
>   https://github.com/postgres/postgres/blob/5d39becf8ba0080c98fee4b63575552f6800b012/src/backend/optim...
> bms_next_member() is allowed to return the zero as a valid value. Subsequent rt_fetch() offsets that
> zero to -1 which leads to the assertion down the code. Nothing wrong here? Either zero is simply not
> possible after that bms_next_member() because of some factors behind the code?
>

rtindex 0 is not used, see the logic of setup_simple_rel_arrays and the comments
of PlannerInfo.simple_rel_array.

/*
* simple_rel_array holds pointers to "base rels" and "other rels" (see
* comments for RelOptInfo for more info). It is indexed by rangetable
* index (so entry 0 is always wasted). Entries can be NULL when an RTE
* does not correspond to a base relation, such as a join RTE or an
* unreferenced view RTE; or if the RelOptInfo hasn't been made yet.
*/

>
> --
> Best regards,
>  Dmitry                          mailto:[email protected]
>
>
>


-- 
Regards
Junwang Zhao






view thread (4+ 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], [email protected]
  Subject: Re: Unclear code - please elaborate
  In-Reply-To: <CAEG8a3L_4WJk7bHy7Lzy540Biqp=HZry1ghmgMVymOFkJrP2Dw@mail.gmail.com>

* 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