Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-28 Thread Alvaro Herrera
On 2025-Apr-26, jian he wrote: > I am wondering if we need to change the following comments in getTableAttrs. > > * We track in notnull_islocal whether the constraint was defined directly > * in this table or via an ancestor, for binary upgrade. flagInhAttrs > * might modify this

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-25 Thread jian he
On Fri, Apr 25, 2025 at 3:36 AM Alvaro Herrera wrote: > > On 2025-Apr-09, jian he wrote: > > > hi. > > > > attached patch is for address pg_dump inconsistency > > when parent is "not null not valid" while child is "not null". > > Here's my take on this patch. We don't really need the > notnull_pa

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-25 Thread Alvaro Herrera
On 2025-Apr-23, Nathan Bossart wrote: > This one was briefly discussed in an RMT meeting. > > On Wed, Apr 09, 2025 at 01:16:20PM +0800, jian he wrote: > > attached patch is for address pg_dump inconsistency > > when parent is "not null not valid" while child is "not null". > > I see an open item

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-24 Thread Alvaro Herrera
On 2025-Apr-09, jian he wrote: > hi. > > attached patch is for address pg_dump inconsistency > when parent is "not null not valid" while child is "not null". Here's my take on this patch. We don't really need the notnull_parent_invalid flag; in flagInhAttrs we can just set "islocal" to convince

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-23 Thread Nathan Bossart
This one was briefly discussed in an RMT meeting. On Wed, Apr 09, 2025 at 01:16:20PM +0800, jian he wrote: > attached patch is for address pg_dump inconsistency > when parent is "not null not valid" while child is "not null". I see an open item [0] that points to this patch, but there's no owner

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-10 Thread Alvaro Herrera
On 2025-Apr-07, Tom Lane wrote: > Alvaro Herrera writes: > > I have pushed this after some small additional changes. > > Looks like some of the test cases have issues with locale-dependent > ordering. > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jay&dt=2025-04-07%2017%3A56%3A49

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-10 Thread Tom Lane
Alvaro Herrera writes: > I have pushed this after some small additional changes. Looks like some of the test cases have issues with locale-dependent ordering. https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jay&dt=2025-04-07%2017%3A56%3A49 regards, tom lane

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-08 Thread jian he
hi. attached patch is for address pg_dump inconsistency when parent is "not null not valid" while child is "not null". The following query before/after pg_dump should return the same result. select conrelid::regclass::text, conname, convalidated, coninhcount, conislocal, conparentid, contype fro

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-07 Thread Rushabh Lathia
On Tue, Apr 8, 2025 at 1:24 AM Alvaro Herrera wrote: > On 2025-Apr-07, jian he wrote: > > > CREATE TABLE t (a int, b int); > > INSERT INTO t VALUES (NULL, 1), (300, 3); > > ALTER TABLE t ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok > > ALTER TABLE t add column c float8 default random(); > > the

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-07 Thread Alvaro Herrera
On 2025-Apr-07, jian he wrote: > CREATE TABLE t (a int, b int); > INSERT INTO t VALUES (NULL, 1), (300, 3); > ALTER TABLE t ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok > ALTER TABLE t add column c float8 default random(); > the last query should not fail. Agreed. > if we want more places use C

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-07 Thread jian he
hi. CREATE TABLE t (a int, b int); INSERT INTO t VALUES (NULL, 1), (300, 3); ALTER TABLE t ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok ALTER TABLE t add column c float8 default random(); the last query should not fail. if we want more places use CompactAttribute->attnullability set_attnotnull

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-06 Thread Alvaro Herrera
On 2025-Apr-05, jian he wrote: > hi. > + /* FIXME use CompactAttribute */ > Form_pg_attribute att = TupleDescAttr(relation->rd_att, i - > 1); > if (att->attnotnull && att->attnotnullvalid && > !att->attisdropped) > { >

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-05 Thread Álvaro Herrera
Hi I've been giving this some final polish which have me time to think it through, and I think Peter is right. We should not be adding the new column, but instead RelationBuildTupleDesc should use its existing scan of pg_constraint to determine validity status of constraints. We may need in add

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-05 Thread Alvaro Herrera
On 2025-Mar-21, jian he wrote: > * if partitioned table have valid not-null, then partition with > invalid not-null can not attach to the partition tree. Correct. > if partitioned table have not valid not-null, we *can* attach a > valid not-null to the partition tree. Also correct. > (inhe

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-05 Thread Robert Haas
On Wed, Apr 2, 2025 at 5:17 AM Alvaro Herrera wrote: > I don't quite love this behavior, but since there have been no > complaints, I suppose it's okay and we should just do the same for > not-nulls. I don't understand the issue. It seems like the pg_dump output shown here would recreate the cata

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-05 Thread jian he
On Fri, Apr 4, 2025 at 7:54 PM Rushabh Lathia wrote: > > 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 m

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-04 Thread Rushabh Lathia
Hi Alvaro, Thank you for the offline discussion. As we all agree, changing the attnotnull datatype would not be a good idea since it is a commonly used catalog column, and many applications and extensions depend on it. Attached is another version of the patch (WIP), where I have introduced a new

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-04 Thread jian he
On Thu, Mar 20, 2025 at 11:53 PM Alvaro Herrera wrote: > > On 2025-Mar-20, jian he wrote: > > > > Is it expected that a child may have VALID constraint but parent has > > > not valid constraint? > > > > but the MergeConstraintsIntoExisting logic is when > > ALTER TABLE ATTACH PARTITION, > > it exp

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-04 Thread Rushabh Lathia
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

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread Rushabh Lathia
On Thu, Apr 3, 2025 at 8:33 PM Peter Eisentraut wrote: > On 03.04.25 10:07, Alvaro Herrera wrote: > > 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 sl

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread Peter Eisentraut
On 03.04.25 10:07, Alvaro Herrera wrote: 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-nul

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread Alvaro Herrera
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 her

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread Peter Eisentraut
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. Reading up on this again now, I'm confuse

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-03 Thread jian he
On Thu, Apr 3, 2025 at 2:24 AM Alvaro Herrera wrote: > > create table singlepp (id bigint default 1) partition by list (id); > alter table singlepp add constraint dummy_constr not null id not valid; > create table singlepp_1 (id bigint default 1); > alter table singlepp_1 add constraint dummy_cons

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread Alvaro Herrera
On 2025-Apr-02, jian he wrote: > we need special code for handing parent is invalid, child is valid > (table inheritance or partitioning). H. I'm going to focus on this case, which is the simplest one we care about (no multi-level hierarchy, only not null constraint): create table singlepp

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread jian he
> > > > i think your patch messed up with pg_constraint.conislocal. > > for example: > > > > CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST > > (id); > > alter TABLE parted add CONSTRAINT dummy_cons

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread Rushabh Lathia
Hi Alvaro, As discussed, I have added a few more tests related to pg_dump and pg_upgrade. Specifically: - Added INHERIT and PARTITION test cases to constraints.sql, keeping the objects unchanged so they can be used in the pg_upgrade test - Included additional tests in 002_pg_dump.pl for

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread Alvaro Herrera
On 2025-Mar-31, Robert Haas wrote: > It seems like a bad idea to make conislocal and coninhcount have > anything to do with whether the constraint is valid. We need those to > mean what they have traditionally meant just to make the correct > things happen when the constraint is dropped, either di

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread Alvaro Herrera
Hello, thanks for the review. On 2025-Apr-02, jian he wrote: > the following are reviews of changes in pg_dump > on v6-0001-NOT-NULL-NOT-VALID.patch > > minor style tweak: > + "CASE WHEN NOT co.convalidated THEN co.oid" > + " ELSE NULL END AS notnull_invalidoid,\n" > > align with surrounding co

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-02 Thread Rushabh Lathia
> > > i think your patch messed up with pg_constraint.conislocal. > > for example: > > > > CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY > LIST (id); > > alter TABLE parted add CONSTRAINT dummy_constr no

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-01 Thread jian he
hi. the following are reviews of changes in pg_dump on v6-0001-NOT-NULL-NOT-VALID.patch minor style tweak: + "CASE WHEN NOT co.convalidated THEN co.oid" + " ELSE NULL END AS notnull_invalidoid,\n" align with surrounding code convention: leave white space at the end, not beginning. maybe we can +

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-04-01 Thread Alvaro Herrera
On 2025-Mar-28, jian he wrote: > ATPrepAddPrimaryKey > + if (!conForm->convalidated) > + ereport(ERROR, > + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > + errmsg("not-null constraint \"%s\" of table \"%s\" has not been validated", > + NameStr(conForm->conname), > + RelationGetRelationN

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread Robert Haas
On Fri, Mar 28, 2025 at 2:42 PM Alvaro Herrera wrote: > Maybe the real problem here is that making the (valid) child constraint > no longer local when the parent constraint is not valid is not sensible, > precisely because pg_dump won't be able to produce good output. That > sounds more workable

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread Alvaro Herrera
On 2025-Mar-31, jian he wrote: > hi. > in notnull-notvalid.patch > > + if (coninfo->contype == 'c') > + keyword = "CHECK CONSTRAINT"; > + else > + keyword = "INVALID NOT NULL CONSTRAINT"; > we have a new TocEntry->desc kind. Yeah, I wasn't sure that this change made much actual sense. I think i

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread jian he
hi. in notnull-notvalid.patch + if (coninfo->contype == 'c') + keyword = "CHECK CONSTRAINT"; + else + keyword = "INVALID NOT NULL CONSTRAINT"; we have a new TocEntry->desc kind. so the following related code within src/bin/pg_dump also needs change

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-31 Thread jian he
On Sat, Mar 29, 2025 at 2:42 AM Alvaro Herrera wrote: > > On 2025-Mar-28, jian he wrote: > > > i think your patch messed up with pg_constraint.conislocal. > > for example: > > > > CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST > > (id); > > alter TABLE parted add CONSTR

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-28 Thread Alvaro Herrera
On 2025-Mar-28, jian he wrote: > i think your patch messed up with pg_constraint.conislocal. > for example: > > CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST > (id); > alter TABLE parted add CONSTRAINT dummy_constr not null id not valid; > CREATE TABLE parted_1 (id bi

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-28 Thread jian he
On Fri, Mar 28, 2025 at 3:25 AM Alvaro Herrera wrote: > > On 2025-Mar-24, jian he wrote: > > > hi. > > you may like the attached. it's based on your idea: attnotnullvalid. > > This is quite close to what I was thinking, yeah. I noticed a couple of > bugs however, and ended up cleaning up the whol

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-27 Thread Robert Haas
On Wed, Mar 12, 2025 at 2:20 PM Alvaro Herrera wrote: > Taking a step back after discussing this with some colleagues, I need to > contradict what I said at the start of this thread. There's a worry > that changing pg_attribute.attnotnull in the way I initially suggested > might not be such a gre

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-27 Thread Ashutosh Bapat
On Thu, Mar 20, 2025 at 3:25 PM Rushabh Lathia wrote: > > Hi Alvaro, > > Thank you for the offline discussion. > > As we all agree, changing the attnotnull datatype would not be a good idea > since it is > a commonly used catalog column, and many applications and extensions depend > on it. > > A

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-27 Thread Alvaro Herrera
On 2025-Mar-24, jian he wrote: > hi. > you may like the attached. it's based on your idea: attnotnullvalid. This is quite close to what I was thinking, yeah. I noticed a couple of bugs however, and ended up cleaning up the whole thing. Here's what I have so far. I'm not sure the pg_dump bits a

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-24 Thread Robert Haas
On Mon, Mar 24, 2025 at 12:29 PM Alvaro Herrera wrote: > > Again, I'm not 100% positive that changing the Boolean column to a > > three-valued column is the right way forward, but it does have the > > advantage of saving a byte, and the width of system catalog tables has > > been a periodic concer

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-24 Thread Alvaro Herrera
On 2025-Mar-24, Robert Haas wrote: > I mean, maybe there's an argument that some changes are more > disruptive than others. For instance, if removing attndims would force > drivers to run extra more complicated queries to learn whether a > certain type is an array type, one could argue that taking

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-24 Thread Robert Haas
On Fri, Mar 21, 2025 at 2:04 PM Alvaro Herrera wrote: > In several of the cases that I checked, the application just tests the > returned value for boolean truth. If we change the column from boolean > to char, they would stop working properly because both the 't' and the > 'f' char values would

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-23 Thread jian he
hi. you may like the attached. it's based on your idea: attnotnullvalid. I came across a case, not sure if it's a bug. CREATE TABLE ttchk (a INTEGER); ALTER TABLE ttchk ADD CONSTRAINT cc check (a is NOT NULL) NOT VALID; CREATE TABLE ttchk_child(a INTEGER) INHERITS(ttchk); ttchk_child's constraint

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-21 Thread Alvaro Herrera
On 2025-Mar-21, Robert Haas wrote: > I don't agree with this conclusion. Uhm. > The 8.3 casting changes were problematic because any piece of SQL > you'd ever written could have problems. Okay, this much I agree with. > This change will only break queries that look at the attnotnull > column.

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread Alvaro Herrera
On 2025-Mar-20, jian he wrote: > > Is it expected that a child may have VALID constraint but parent has > > not valid constraint? > > but the MergeConstraintsIntoExisting logic is when > ALTER TABLE ATTACH PARTITION, > it expects the child table to also have an equivalent constraint > definition o

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread jian he
On Thu, Mar 20, 2025 at 8:20 PM Ashutosh Bapat wrote: > > On Thu, Mar 20, 2025 at 3:25 PM Rushabh Lathia > wrote: > > > > Hi Alvaro, > > > > Thank you for the offline discussion. > > > > As we all agree, changing the attnotnull datatype would not be a good idea > > since it is > > a commonly us

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread Alvaro Herrera
On 2025-Mar-20, jian he wrote: > as you can see the output of `\d+ notnull_tbl1` > That means the pg_attribute.attnotnull definition is changed. That's correct, it changed in that way. I propose for the new docs: > > >attnotnull bool > > >This column h

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread jian he
On Thu, Mar 20, 2025 at 5:54 PM Rushabh Lathia wrote: > hi. looking at the regress tests. +-- verify NOT NULL VALID/NOT VALID +CREATE TABLE notnull_tbl1 (a INTEGER, b INTEGER); +INSERT INTO notnull_tbl1 VALUES (NULL, 1); +INSERT INTO notnull_tbl1 VALUES (NULL, 2); +INSERT INTO notnull_tbl1 VALUES

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-20 Thread Alvaro Herrera
Hello On 2025-Mar-20, Rushabh Lathia wrote: > Attached is another version of the patch (WIP), where I have > introduced a new catalog column, pg_attribute.attinvalidnotnull > (boolean). This column will default to FALSE but will be set to TRUE > when an INVALID NOT NULL constraint is created. Wi

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-17 Thread Alvaro Herrera
On 2025-Mar-17, jian he wrote: > hi. > I played around with it. > > current syntax, we don't need to deal with column constraint grammar. > like the following can fail directly: > create table t0(a int constraint nn not null a not valid); > we only support table constraint cases like: > alter tab

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-17 Thread jian he
hi. I played around with it. current syntax, we don't need to deal with column constraint grammar. like the following can fail directly: create table t0(a int constraint nn not null a not valid); we only support table constraint cases like: alter table lp add constraint nc1 not null a not valid;

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-15 Thread Rushabh Lathia
On Wed, Mar 12, 2025 at 11:50 PM Alvaro Herrera wrote: > On 2025-Mar-12, Rushabh Lathia wrote: > > > Hi Alvaro, > > > > Here are the latest patches, which includes the regression fix. > > Thank you. > > Taking a step back after discussing this with some colleagues, I need to > contradict what I s

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-15 Thread Alvaro Herrera
On 2025-Mar-10, Rushabh Lathia wrote: > I adjusted the set_attnotnull() API and removed the added > queue_validation parameter. Rather, the function start using wqueue > input parameter as a check. > If wqueue is NULL, skip the queue_validation. Attaching patch here, > but not sure how clear it

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-15 Thread Alvaro Herrera
On 2025-Mar-12, Ashutosh Bapat wrote: > If the test passes for you, can you please try the patches at [1] on > top of your patches? Please apply those, set and export environment > variable PG_TEST_EXTRA=regress_dump_test, and run 002_pg_upgrade test? > I intended to do this but can not do it sinc

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-15 Thread Rushabh Lathia
On Thu, Feb 27, 2025 at 3:25 PM Rushabh Lathia wrote: > Thank Alvaro for the fixup patch. > > > > > On Fri, Feb 21, 2025 at 11:43 AM Alvaro Herrera > wrote: > >> Hello, >> >> Thanks! >> >> I noticed a typo 'constrint' in several places; fixed in the attached. >> >> I discovered that this sequenc

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Alvaro Herrera
On 2025-Mar-12, Rushabh Lathia wrote: > Hi Alvaro, > > Here are the latest patches, which includes the regression fix. Thank you. Taking a step back after discussing this with some colleagues, I need to contradict what I said at the start of this thread. There's a worry that changing pg_attrib

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Rushabh Lathia
On Wed, Mar 12, 2025 at 3:20 PM Alvaro Herrera wrote: > On 2025-Mar-12, Ashutosh Bapat wrote: > > > If the test passes for you, can you please try the patches at [1] on > > top of your patches? Please apply those, set and export environment > > variable PG_TEST_EXTRA=regress_dump_test, and run 00

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Alvaro Herrera
On 2025-Mar-12, Ashutosh Bapat wrote: > The 002_pg_upgrade test passes with and without my patches now. But > then the tests added here do not leave behind any parent-child table. > Previously we have found problems in dumping and restoring constraints > in an inheritance hierarchy. I think the te

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Rushabh Lathia
Hi Alvaro, Here are the latest patches, which includes the regression fix. Thanks, On Wed, Mar 12, 2025 at 3:38 PM Ashutosh Bapat wrote: > On Wed, Mar 12, 2025 at 3:20 PM Alvaro Herrera > wrote: > > > > On 2025-Mar-12, Ashutosh Bapat wrote: > > > > > If the test passes for you, can you ple

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Ashutosh Bapat
On Wed, Mar 12, 2025 at 3:52 PM Rushabh Lathia wrote: > > > Hi Alvaro, > > Here are the latest patches, which includes the regression fix. > The 002_pg_upgrade test passes with and without my patches now. But then the tests added here do not leave behind any parent-child table. Previously we have

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Ashutosh Bapat
On Wed, Mar 12, 2025 at 3:20 PM Alvaro Herrera wrote: > > On 2025-Mar-12, Ashutosh Bapat wrote: > > > If the test passes for you, can you please try the patches at [1] on > > top of your patches? Please apply those, set and export environment > > variable PG_TEST_EXTRA=regress_dump_test, and run 0

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-12 Thread Ashutosh Bapat
On Tue, Mar 11, 2025 at 3:46 PM Rushabh Lathia wrote: >> >> > JFYI, I can reproduce the failure Ashutosh Bapat reported, while >> > running the pg_upgrade test through meson commands. I am >> > investigating that further. >> >> Ah good, thanks. > > > Somehow, I am now not able to reproduce after

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-03-11 Thread Rushabh Lathia
On Mon, Mar 10, 2025 at 5:20 PM Alvaro Herrera wrote: > On 2025-Mar-10, Rushabh Lathia wrote: > > > I adjusted the set_attnotnull() API and removed the added > > queue_validation parameter. Rather, the function start using wqueue > > input parameter as a check. > > If wqueue is NULL, skip the qu

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-27 Thread Rushabh Lathia
Thank Alvaro for the fixup patch. On Fri, Feb 21, 2025 at 11:43 AM Alvaro Herrera wrote: > Hello, > > Thanks! > > I noticed a typo 'constrint' in several places; fixed in the attached. > > I discovered that this sequence, taken from added regression tests, > > CREATE TABLE notnull_tbl1 (a int

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-24 Thread Ashutosh Bapat
On Fri, Feb 21, 2025 at 6:25 PM Alvaro Herrera wrote: > > On 2025-Feb-21, Ashutosh Bapat wrote: > > > If I apply your patches, build binaries, I see failure. I reverted > > your patches, built binaries, I don't see failure. I apply your > > patches again, built binaries, it fails again. > > I can'

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-21 Thread Alvaro Herrera
On 2025-Feb-21, Alvaro Herrera wrote: > I see a nonrepeatable problem under valgrind which I'm going to look > into. Sorry, pilot error. The pg_upgrade test works fine under valgrind. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Having your biases confirmed

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-21 Thread Alvaro Herrera
On 2025-Feb-21, Ashutosh Bapat wrote: > If I apply your patches, build binaries, I see failure. I reverted > your patches, built binaries, I don't see failure. I apply your > patches again, built binaries, it fails again. I can't reproduce the problem either. Are you running asserts disabled or

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-21 Thread Ashutosh Bapat
On Fri, Feb 21, 2025 at 3:37 PM Rushabh Lathia wrote: > > > > On Fri, Feb 21, 2025 at 2:59 PM Ashutosh Bapat > wrote: >> >> On Fri, Feb 21, 2025 at 11:43 AM Alvaro Herrera >> wrote: >> > >> > I have not looked at the pg_dump code yet, so the changes included here >> > are just pgindent. >> > >

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-21 Thread Rushabh Lathia
On Fri, Feb 21, 2025 at 2:59 PM Ashutosh Bapat wrote: > On Fri, Feb 21, 2025 at 11:43 AM Alvaro Herrera > wrote: > > > > I have not looked at the pg_dump code yet, so the changes included here > > are just pgindent. > > > > I ran pg_upgrade suite with the patches. 002_pg_upgrade fails with > fol

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-21 Thread Ashutosh Bapat
On Fri, Feb 21, 2025 at 11:43 AM Alvaro Herrera wrote: > > I have not looked at the pg_dump code yet, so the changes included here > are just pgindent. > I ran pg_upgrade suite with the patches. 002_pg_upgrade fails with following test log not ok 14 - run of pg_upgrade for new instance not ok 15

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-20 Thread Alvaro Herrera
Hello, Thanks! I noticed a typo 'constrint' in several places; fixed in the attached. I discovered that this sequence, taken from added regression tests, CREATE TABLE notnull_tbl1 (a int); ALTER TABLE notnull_tbl1 ADD CONSTRAINT nn_parent not null a not valid; CREATE TABLE notnull_chld (a int);

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-12 Thread Rushabh Lathia
On Mon, Feb 10, 2025 at 10:48 PM Rushabh Lathia wrote: > Hi Alvaro, > > I have incorporated the suggested changes, and here is the latest version > of the patch: > >- Added more test cases to the regression suite. >- Included tests in the pg_dump test. >- Left objects with *INVALID NO

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-10 Thread Rushabh Lathia
Hi Alvaro, I have incorporated the suggested changes, and here is the latest version of the patch: - Added more test cases to the regression suite. - Included tests in the pg_dump test. - Left objects with *INVALID NOT NULL* for pg_upgrade. - Fixed an issue where recursion to child ta

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-09 Thread Rushabh Lathia
On Fri, Feb 7, 2025 at 4:44 PM Alvaro Herrera wrote: > > Recursion to child tables is incorrectly trying to locate the constraint > by name: > > create table notnull_tbl1 (a int); > alter table notnull_tbl1 add constraint foo not null a not valid; > create table notnull_chld (a int); > alter tabl

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-09 Thread Rushabh Lathia
Thanks Alvaro. On Thu, Feb 6, 2025 at 9:58 PM Alvaro Herrera wrote: > Hello Rushabh, > > On 2025-Feb-06, Rushabh Lathia wrote: > > > Commit 14e87ffa5c543b5f30ead7413084c25f7735039f > > < > https://github.com/postgres/postgres/commit/14e87ffa5c543b5f30ead7413084c25f7735039f > > > > added the supp

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-07 Thread Alvaro Herrera
Recursion to child tables is incorrectly trying to locate the constraint by name: create table notnull_tbl1 (a int); alter table notnull_tbl1 add constraint foo not null a not valid; create table notnull_chld (a int); alter table notnull_chld add constraint blah not null a not valid; alter table

Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-06 Thread Alvaro Herrera
Hello Rushabh, On 2025-Feb-06, Rushabh Lathia wrote: > Commit 14e87ffa5c543b5f30ead7413084c25f7735039f > > added the support for named NOT NULL constraints. We can now support > the NOT VALID/VALID named NOT

Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

2025-02-06 Thread Rushabh Lathia
Hi, Commit 14e87ffa5c543b5f30ead7413084c25f7735039f added the support for named NOT NULL constraints. We can now support the NOT VALID/VALID named NOT NULL constraints. This patch supports the NOT VALID and V