Re: Revert: Remove useless self-joins *and* -DREALLOCATE_BITMAPSETS make server crash, regress test fail.

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>, Richard Guo <guofenglinux@gmail.com>, jian he <jian.universality@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-05-07T11:45:48Z
Lists: pgsql-hackers
On Tue, May 7, 2024 at 8:29 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> David Rowley <dgrowleyml@gmail.com> writes:
> > Yeah, before the revert, that did:
> > -       sjinf->syn_lefthand = replace_relid(sjinf->syn_lefthand, relid, subst);
> > That replace code seems to have always done a bms_copy()
>
> Hmm, not always; see e0477837c.
>
> What I'm trying to figure out here is whether we have a live bug
> in this area in released branches; and if so, why we've not seen
> reports of that.

I didn't yet spot a particular bug.  But this place looks dangerous,
and it's very hard to prove there is no bug.  Even if there is no bug,
it seems very easy to unintentionally add a bug here.  Should we just
accept to always do bms_copy()?

------
Regards,
Alexander Korotkov
Supabase



Commits

  1. Make left-join removal safe under -DREALLOCATE_BITMAPSETS.

  2. Revert: Remove useless self-joins

  3. Remove mention of nchar