From: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
---|---|
To: | Dmitry Nikitin <pgsql-hackers(at)dima(dot)nikitin(dot)name> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Unclear code - please elaborate |
Date: | 2024-11-30 11:54:35 |
Message-ID: | CAEG8a3L_4WJk7bHy7Lzy540Biqp=HZry1ghmgMVymOFkJrP2Dw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Nov 30, 2024 at 4:15 PM Dmitry Nikitin
<pgsql-hackers(at)dima(dot)nikitin(dot)name> wrote:
>
> Hello ,
>
> https://github.com/postgres/postgres/blob/5d39becf8ba0080c98fee4b63575552f6800b012/src/backend/optimizer/prep/prepjointree.c#L3856
> 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:pgsql-hackers(at)dima(dot)nikitin(dot)name
>
>
>
--
Regards
Junwang Zhao
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2024-11-30 12:22:00 | speedup ALTER TABLE ADD CHECK CONSTRAINT. |
Previous Message | Michael Banck | 2024-11-30 11:41:15 | [patch] Make "invalid record length at <LSN>: expected at least 24, got 0" message less scary |