From: | Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Support for NO INHERIT to INHERIT state change with named NOT NULL constraints |
Date: | 2024-11-14 05:01:56 |
Message-ID: | CAF1DzPVfOW6Kk=7SSh7LbneQDJWh=PbJrEC_Wkzc24tHOyQWGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Upstream commit 14e87ffa5c543b5f30ead7413084c25f7735039f
<https://github.com/postgres/postgres/commit/14e87ffa5c543b5f30ead7413084c25f7735039f>
added the support for named NOT NULL constraints which are INHERIT by
default.
We can declare those as NO INHERIT which means those constraints will not
be inherited to child tables and after this state, we don't have the
functionality to change the state back to INHERIT.
This patch adds this support where named NOT NULL constraint defined as NO
INHERIT can be changed to INHERIT.
For this, introduced the new syntax something like -
ALTER TABLE <tabname> ALTER CONSTRAINT <constrname> INHERIT;
Once the not null constraints are altered to INHERIT from NO INHERIT,
recurse to all children and propagate the constraint if it doesn't exist.
Alvaro stated that allowing a not null constraint state to be modified from
INHERIT to NO INHERIT is going to be quite problematic because of the
number of weird cases to avoid, so for now that support is not added.
Please share your thoughts on the same.
--
Thanks & Regards,
Suraj kharage,
Attachment | Content-Type | Size |
---|---|---|
v1-alter_not_null_constraint_to_inherit.patch | application/x-patch | 30.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2024-11-14 06:15:56 | Re: logical replication: restart_lsn can go backwards (and more), seems broken since 9.4 |
Previous Message | Michael Paquier | 2024-11-14 04:45:39 | Re: Statistics Import and Export |