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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: huseyin(dot)d3r(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists
Date: 2026-02-21 15:13:59
Message-ID: 55bdb57fe6d84b0acb56c369c699546086b983ca.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sat, 2026-02-21 at 12:56 +0100, Álvaro Herrera wrote:
> > 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.
>
> Thanks for this! I have pushed it now to 18 and master (right before
> the embargo for next week's release -- not really apologizing about
> that, since this is clearly something that's going to bite users as they
> move up to 18).

Thank you, and thanks for the code improvements.

> 1. this will cause an ABI break report for AddRelationNotNullConstraints
> in branch 18. I considered the idea of adding a shim function
> preserving the original API, but I think this is not a function likely
> to be used by third-party code. So I'll address this by adding an entry
> to .abi-compliance-history instead.

I decided not to worry about changing the signature of that global function,
because it is only used in a single place and - like you - I deem it unlikely
to be useful elsewhere.

Yours,
Laurenz Albe

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2026-02-22 03:40:10 Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists
Previous Message David G. Johnston 2026-02-21 15:05:06 Re: BUG: SUBSTRING on TOASTed text returns "invalid byte sequence for encoding UTF8: 0xc3"

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-02-21 15:29:36 Re: generating function default settings from pg_proc.dat
Previous Message jian he 2026-02-21 15:07:52 Re: refactor ExecInitPartitionInfo