Re: Incorrect handling of IS [NOT] NULL quals on inheritance parents - Mailing list pgsql-hackers

From David Rowley
Subject Re: Incorrect handling of IS [NOT] NULL quals on inheritance parents
Date
Msg-id CAApHDvo9U51PK3YeNOPYOOVpfvZvBK-XABegueEH==2WoHwKiQ@mail.gmail.com
Whole thread Raw
In response to Re: Incorrect handling of IS [NOT] NULL quals on inheritance parents  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, 10 Apr 2024 at 17:18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > I think a better fix is just to not apply the optimisation for
> > inheritance RTEs in add_base_clause_to_rel().
>
> Is it worth paying attention to whether the constraint is marked
> connoinherit?  If that involves an extra syscache fetch, I'd tend to
> agree that it's not worth it; but if we can get that info for free
> it seems worthwhile to not break this for inheritance cases.

I think everything should be optimised as we like without that.
Effectively get_relation_info() looks at the pg_attribute.attnotnull
column for the relation in question. We never look at the
pg_constraint record to figure out the nullability of the column.

David



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Improve eviction algorithm in ReorderBuffer
Next
From: jian he
Date:
Subject: Re: Can't find not null constraint, but \d+ shows that