=== Applying patches on top of PostgreSQL commit ID 73e26cbeb5927053eea4e209e5eda34a30c353f1 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sun Jun 8 06:47:19 UTC 2025 On branch cf/5796 nothing to commit, working tree clean === using 'git am' to apply patch ./v1-0001-alter-check-constraint-enforceability.patch === Applying: alter check constraint enforceability Using index info to reconstruct a base tree... M src/backend/commands/tablecmds.c Falling back to patching base and 3-way merge... Auto-merging src/backend/commands/tablecmds.c CONFLICT (content): Merge conflict in src/backend/commands/tablecmds.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 alter check constraint enforceability When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Unstaged changes after reset: M doc/src/sgml/ref/alter_table.sgml M src/backend/commands/tablecmds.c M src/test/regress/expected/constraints.out M src/test/regress/expected/inherit.out M src/test/regress/sql/constraints.sql M src/test/regress/sql/inherit.sql === using patch(1) to apply patch ./v1-0001-alter-check-constraint-enforceability.patch === patching file doc/src/sgml/ref/alter_table.sgml patching file src/backend/commands/tablecmds.c Hunk #3 FAILED at 438. Hunk #4 FAILED at 11874. Hunk #5 succeeded at 12161 (offset 3 lines). Hunk #6 succeeded at 12223 (offset 3 lines). Hunk #7 succeeded at 12331 (offset 3 lines). Hunk #8 succeeded at 12376 (offset 3 lines). Hunk #9 FAILED at 13074. Hunk #10 FAILED at 13108. Hunk #11 FAILED at 13138. Hunk #12 FAILED at 13179. 6 out of 12 hunks FAILED -- saving rejects to file src/backend/commands/tablecmds.c.rej patching file src/test/regress/expected/constraints.out patching file src/test/regress/expected/inherit.out patching file src/test/regress/sql/constraints.sql patching file src/test/regress/sql/inherit.sql Unstaged changes after reset: M doc/src/sgml/ref/alter_table.sgml M src/backend/commands/tablecmds.c M src/test/regress/expected/constraints.out M src/test/regress/expected/inherit.out M src/test/regress/sql/constraints.sql M src/test/regress/sql/inherit.sql Removing src/backend/commands/tablecmds.c.rej === using 'git apply' to apply patch ./v1-0001-alter-check-constraint-enforceability.patch === Applied patch to 'doc/src/sgml/ref/alter_table.sgml' cleanly. Applied patch to 'src/backend/commands/tablecmds.c' with conflicts. Applied patch to 'src/test/regress/expected/constraints.out' cleanly. Applied patch to 'src/test/regress/expected/inherit.out' cleanly. Applied patch to 'src/test/regress/sql/constraints.sql' cleanly. Applied patch to 'src/test/regress/sql/inherit.sql' cleanly. U src/backend/commands/tablecmds.c diff --cc src/backend/commands/tablecmds.c index ea96947d813,9c1466041f9..00000000000 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@@ -430,8 -437,8 +437,13 @@@ static void AlterConstrUpdateConstraint static ObjectAddress ATExecValidateConstraint(List **wqueue, Relation rel, char *constrName, bool recurse, bool recursing, LOCKMODE lockmode); ++<<<<<<< ours +static void QueueFKConstraintValidation(List **wqueue, Relation conrel, Relation fkrel, + Oid pkrelid, HeapTuple contuple, LOCKMODE lockmode); ++======= + static void QueueFKConstraintValidation(List **wqueue, Relation conrel, Relation rel, + HeapTuple contuple, LOCKMODE lockmode, bool recursing); ++>>>>>>> theirs static void QueueCheckConstraintValidation(List **wqueue, Relation conrel, Relation rel, char *constrName, HeapTuple contuple, bool recurse, bool recursing, LOCKMODE lockmode); @@@ -11866,11 -11872,9 +11878,16 @@@ AttachPartitionForeignKey(List **wqueue if (!HeapTupleIsValid(partcontup)) elog(ERROR, "cache lookup failed for constraint %u", partConstrOid); + confrelid = ((Form_pg_constraint) GETSTRUCT(partcontup))->confrelid; + /* Use the same lock as for AT_ValidateConstraint */ ++<<<<<<< ours + QueueFKConstraintValidation(wqueue, conrel, partition, confrelid, + partcontup, ShareUpdateExclusiveLock); ++======= + QueueFKConstraintValidation(wqueue, conrel, partition, partcontup, + ShareUpdateExclusiveLock, false); ++>>>>>>> theirs ReleaseSysCache(partcontup); table_close(conrel, RowExclusiveLock); } @@@ -12925,8 -13074,7 +13090,12 @@@ ATExecValidateConstraint(List **wqueue { if (con->contype == CONSTRAINT_FOREIGN) { ++<<<<<<< ours + QueueFKConstraintValidation(wqueue, conrel, rel, con->confrelid, + tuple, lockmode); ++======= + QueueFKConstraintValidation(wqueue, conrel, rel, tuple, lockmode, false); ++>>>>>>> theirs } else if (con->contype == CONSTRAINT_CHECK) { @@@ -12959,8 -13107,8 +13128,13 @@@ * for the specified relation and all its children. */ static void ++<<<<<<< ours +QueueFKConstraintValidation(List **wqueue, Relation conrel, Relation fkrel, + Oid pkrelid, HeapTuple contuple, LOCKMODE lockmode) ++======= + QueueFKConstraintValidation(List **wqueue, Relation conrel, Relation rel, + HeapTuple contuple, LOCKMODE lockmode, bool recursing) ++>>>>>>> theirs { Form_pg_constraint con; AlteredTableInfo *tab; @@@ -13000,8 -13138,11 +13174,16 @@@ newcon->qual = (Node *) fkconstraint; /* Find or create work queue entry for this table */ ++<<<<<<< ours + tab = ATGetQueueEntry(wqueue, fkrel); + tab->constraints = lappend(tab->constraints, newcon); ++======= + if (!recursing) + { + tab = ATGetQueueEntry(wqueue, rel); + tab->constraints = lappend(tab->constraints, newcon); + } ++>>>>>>> theirs } /* @@@ -13041,12 -13181,8 +13223,17 @@@ childrel = table_open(childcon->conrelid, lockmode); ++<<<<<<< ours + /* + * NB: Note that pkrelid should be passed as-is during recursion, + * as it is required to identify the root referenced table. + */ + QueueFKConstraintValidation(wqueue, conrel, childrel, pkrelid, + childtup, lockmode); ++======= + QueueFKConstraintValidation(wqueue, conrel, childrel, childtup, + lockmode, true); ++>>>>>>> theirs table_close(childrel, NoLock); }