Re: pg17 issues with not-null contraints

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg17 issues with not-null contraints
Date: 2024-04-18 13:41:28
Message-ID: 202404181341.sdyofu6hhas5@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-Apr-15, Justin Pryzby wrote:

> Here's a couple more issues affecting upgrades from v16 to v17.
>
> postgres=# CREATE TABLE a(i int NOT NULL); CREATE TABLE b(i int PRIMARY KEY) INHERITS (a);
> pg_restore: error: could not execute query: ERROR: constraint "pgdump_throwaway_notnull_0" of relation "b" does not exist
>
> postgres=# CREATE TABLE a(i int CONSTRAINT a NOT NULL PRIMARY KEY); CREATE TABLE b()INHERITS(a); ALTER TABLE b ADD CONSTRAINT pkb PRIMARY KEY (i);
> pg_restore: error: could not execute query: ERROR: cannot drop inherited constraint "pgdump_throwaway_notnull_0" of relation "b"

I pushed a fix now, and it should also cover these two issues, which
required only minor changes over what I posted yesterday. Also, thank
you for pointing out that the patch also fixed Andrew's problem. It
did, except there was a locking problem which required an additional
tweak.

Thanks for reporting these.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"At least to kernel hackers, who really are human, despite occasional
rumors to the contrary" (LWN.net)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-04-18 14:08:58 Re: pgsql: Fix restore of not-null constraints with inheritance
Previous Message Alvaro Herrera 2024-04-18 13:39:12 Re: cataloguing NOT NULL constraints