From: | Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints |
Date: | 2025-04-04 11:54:37 |
Message-ID: | CAGPqQf2jXkkcHzicPJD6_PjMCp1cVG-ZNtftp9cvWn6XUve9wA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Alvaro,
I’ve consolidated all the changes and attached the latest version of the
patch, which
includes the updates submitted by Jian for pg_dump as well.
Patch 0001 contains changes to MergeWithExistingConstraint to fix the
marking on local constraints.
Patch 0002 includes support for NOT NULL NOT VALID, corresponding pg_dump
changes, test cases,
and documentation updates.
Please let me know if anything is missing or needs further adjustment.
Thanks,
On Thu, Apr 3, 2025 at 1:37 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:
> On 2025-Apr-03, Peter Eisentraut wrote:
>
> > It occurred to me that we will also want to have NOT NULL NOT ENFORCED
> > constraints eventually. As we have discussed elsewhere, the NOT
> > ENFORCED state is closely related to the NOT VALID state. So that
> > should probably be considered in the design here.
>
> Yeah, I don't think there's time to shoehorn NOT ENFORCED status for
> not-null constraints. I'd guess that it'd take at least a couple of
> weeks to make that work.
>
> > Reading up on this again now, I'm confused about putting the NOT VALID
> > state for not-null constraints into pg_attribute. We have catalogued
> > not-null constraints now, so we can put metadata for them into
> > pg_constraint! And we have NOT VALID and NOT ENFORCED flags in
> > pg_constraint already.
> >
> > So what is the purpose of the attnotnullvalid field? In the latest
> posted
> > patch, I don't see this column used in the executor for the actual
> > constraint checking. So is this all merely for clients to understand the
> > constraint metadata? If we add more metadata for not-null constraints,
> do
> > we need to add a new pg_attribute flag for each one? That doesn't seem
> > right.
>
> The new flag is there for quick access by get_relation_info. We could
> easily not have it otherwise, because clients don't need it, but its
> lack would probably make planning measurably slower because it'd have to
> do syscache access for every single not-null constraint to figure out if
> it's valid or not.
>
> --
> Álvaro Herrera Breisgau, Deutschland —
> https://www.EnterpriseDB.com/
> "Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)
>
--
Rushabh Lathia
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-MergeWithExistingConstraint.patch | application/octet-stream | 2.5 KB |
0002-Support-NOT-VALID-and-VALIDATE-CONSTRAINT-for-named-.patch | application/octet-stream | 89.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2025-04-04 11:55:04 | Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row |
Previous Message | Álvaro Herrera | 2025-04-04 11:53:11 | Re: 002_pg_upgrade is broken for custom install |