Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists

Laurenz Albe <laurenz.albe@cybertec.at>

From: Laurenz Albe <laurenz.albe@cybertec.at>
To: huseyin.d3r@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2026-02-05T16:52:50Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

On Thu, 2026-02-05 at 15:58 +0100, I wrote:
> The bug is actually not in pg_upgrade, but in CREATE TABLE.  The attached patch
> fixes the problem for me by avoiding given constraint names when generating
> the names for NOT NULL constraints.

... and here is v2, including a regression test.

Yours,
Laurenz Albe

Commits

  1. Update .abi-compliance-history for AddRelationNotNullConstraints().

  2. Avoid name collision with NOT NULL constraints