Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vpUsN-009qn9-2J for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Feb 2026 17:16:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vpUsM-00Blh6-0B for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Feb 2026 17:16:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vpUsL-00Blgx-2N for pgsql-bugs@lists.postgresql.org; Mon, 09 Feb 2026 17:16:41 +0000 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vpUsJ-00000001qhA-1Fh7 for pgsql-bugs@lists.postgresql.org; Mon, 09 Feb 2026 17:16:40 +0000 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-66314fa03c9so2903297eaf.2 for ; Mon, 09 Feb 2026 09:16:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770657397; cv=none; d=google.com; s=arc-20240605; b=WV8sDHX2apZWCuW8JYV5KTJO12fPe9r8sH1Ry3NwTnI9PJ4+udCvk6vD9Va7++3r7H NpyyNx85Ct0QPZGif3g3S/fqHWkTGnXpCkYQ4CyWim18eImLYkc4n5quQRtxaH9KP12D wumBok30gExyjWXMCmvm4X6l9QK5RxHlfVRMXiTyxxHZeFSw9rKUbLF3q7yenwfCaRNj Gqh1eS4NTKH1lVqiKEClAO1xl3djqAYf5+8j0fuKUTJqx3IwVr2XctcIaHidEAjMcWHv /U/tquhf39j1Ts2yKktYDEzSgxE0k6EFzg64Ebj/KiX++LJx5vIQrQysFHXo9cUdN0Gv qodw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=TvFCllo+pdni5+/LeA4o7QbFyO8T8uAbERBw3CEidUo=; fh=vR25N3+d8dNHUTLhu+5NPbhqmVDzmSWekj9cOnxEonw=; b=jq1BtGjQBEKmonhEeTBjaGeX+AiXl1n3ga8jxtuqalLYkA2foCbsyxLYZqTTr1ZVwd 1vvZ4esYoba5iZc1g07dzPaUN/pa6XPT4qZzgwvSsSuMQKngPV9oZao8g8xeGDGxB/Qf +QuhSuXCIq3n2G2bLp/oAl29pH3TmIoYNxNXbpxOxcPMiHsaxcYiNTCtcSCehrbNshRe yUTQm6UT6Ygp9FXK5HbkSe0OhCNnpOuvsVLTfoYnYhj2XPY89K6WwJq+xhEiz0KQ33aX qGgYGB+RjrPksFW6y3R7pezWqaKcvNBgFTnK8tiwOyB9A+mncwvZ2FvlZ8w8LF1J+i8B /npg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770657397; x=1771262197; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TvFCllo+pdni5+/LeA4o7QbFyO8T8uAbERBw3CEidUo=; b=fzBqmwMOLyuVBKRybqlHVwlIbaqymKusn17D39/1ddwelZsqb3voBS9oJounER5ShC /GHMPxrTPpL5g2nYDjEI3EtaL1tnY6LBdop7voYy6nMl9fNCWfQioRnKBpBQP04T+ccH TXws+cV8/Gr+DQdlWkJlQhl85pduXrOV8MnRpuQyTjHiMEXaaGHbY9SzU7/m1/ai2HW9 ep5+eN/BmNv0gDLKZsp6K3kdB6gJs7i0622szgcXyKGMHktwkJCSRny/+buRxkzZDo0L l+1yPky4dqbt3BYx3IuGlv1bk/sRuBpGrb9o2II1Aa/2ynNogGiV61m4yzz9mietZh3T 2mMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770657397; x=1771262197; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TvFCllo+pdni5+/LeA4o7QbFyO8T8uAbERBw3CEidUo=; b=Ei7LPOamQtuulzq9CMU32Yas8KZg/RHMw3G8QrMMsiIKlowoYyf8b9RhvwCflA7CKS i84TPChLQf5TbiZNRnzH8G5yAORFkzj4JAs2mNAckvzOWqQXamP+58GUQnStIVHJ/oqi 1sQ4+3dlcb5Kwed/VRKD0A+KuRb49D5U4xRxVu/QM2Q6VOrnHW0fVhJdP4ZKMTtBujBB yJUQibiXlm1efwvIcXf3jNA6Hm73FkPBEtD82n/UC9lGP3hKSf0QsSGBIdzwUYM019NH 7g9A69h8yjpdlP5UZCtO6y1nJlBpBIlXj4L63mJbToIIrn1hN8aQPENJcuMobSsllGvk Z++A== X-Gm-Message-State: AOJu0Yx67/HslLOi3SfIQBGw0Nd8Jrw91n6Hh+CkJZVa/VBihSIkXEXO HNVk5DgngAfbh3+FuCVbgpp7SAYHqcuhJFuMFpUsE6cig0eQI+IplfBON36y58PbTAAaKPPJX3F Lsz6iXNJIkR3NJzqdmB3Q2Rn+9npHTz0= X-Gm-Gg: AZuq6aIUAljHWP7it4SLZ0qg9UuHm5pdcqWVg8+mhyXMMoguo8w5uA78WyU8fxNLQ+1 pb7fFb47WlhlpEdjYM+/72t1GNiVGldDJ5ud8TlX79+Id+pEf0vhINIYCGX3eR/inAs+Un/0jGK BgRl82hYoh3ZQ4FddAGArc2N4JMnd2eRUrwKprhJzFN63s0cOi3plJV5j6KO7+GVqt9G6GIepkk 31Se4bxyv22K8pLTIrI+dodT+9H4nBg9Pq3ZyPUlPcjBWFj+BDGdMET0uRd670z+MWJ4h6B8Tu8 3MzxfWcP4umSTHenuCFZaTfP1BNal6pNll3JTa379Mu6LOZ6BTqJ/qU= X-Received: by 2002:a05:6820:1614:b0:662:f6b4:8c4e with SMTP id 006d021491bc7-66d0d2fb110mr5006922eaf.80.1770657397301; Mon, 09 Feb 2026 09:16:37 -0800 (PST) MIME-Version: 1.0 References: <19393-6a82427485a744cf@postgresql.org> <2b3a2cd5f9b6e82fba6ac45b413291b01dd252ea.camel@cybertec.at> <61c535617992fff830961ecc09a9c20096bc1f36.camel@cybertec.at> In-Reply-To: From: =?UTF-8?Q?H=C3=BCseyin_Demir?= Date: Mon, 9 Feb 2026 18:16:26 +0100 X-Gm-Features: AZwV_Qg8-DaFs-yErRi28qB8KwSL158KWGWShEYtLppXpIZsE6luF7oOUgvNoTw Message-ID: Subject: Re: BUG #19393: pg_upgrade fails with duplicate key violation when CHECK constraint named *_not_null exists To: Laurenz Albe Cc: pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000002f6689064a674d9b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002f6689064a674d9b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, > I would prefer not to, but I don't have a strong opinion about it. > Which name PostgreSQL chooses for the generated NOT NULL constraint > is not important, as long as it doesn't conflict with the existing name. I also agree that it solves the problem in 18 which I already tested. Thanks again for your help. Laurenz Albe , 9 =C5=9Eub 2026 Pzt, 12:01 tarihin= de =C5=9Funu yazd=C4=B1: > On Mon, 2026-02-09 at 07:24 +0100, H=C3=BCseyin Demir wrote: > > Thanks for the patch and LGTM for PostgreSQL 18. > > Thanks for checking! > > > I tried to create following table on PG18 > > > > benchmark=3D# CREATE TABLE two_not_null_constraints ( > > col integer NOT NULL, > > CONSTRAINT two_not_null_constraints_col_not_null CHECK (col IS NOT > NULL) > > ); > > ERROR: duplicate key value violates unique constraint > "pg_constraint_conrelid_contypid_conname_index" > > DETAIL: Key (conrelid, contypid, conname)=3D(16385, 0, > two_not_null_constraints_col_not_null) already exists. > > > > In PG17 I was able to create the table. > > Yes, because what causes your problemm is a new feature in v18. > > > One question during the tests should we confirm the output of > pg_constraint table ? > > It would make sense during the tests but the current test is also good > to proceed. > > > > Yours, > Laurenz Albe > --0000000000002f6689064a674d9b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0

> I would prefe= r not to, but I don't have a strong opinion about it.
> Which nam= e PostgreSQL chooses for the generated NOT NULL constraint
> is not i= mportant, as long as it doesn't conflict with the existing name.
<= div>
I also agree that it solves the problem in 18 which I al= ready tested.=C2=A0
Thanks again for your help.


Laurenz Albe <laurenz.albe@cybertec.at>, 9 =C5=9Eub 2026 Pzt, 12:01 tarihinde= =C5=9Funu yazd=C4=B1:
On Mon, 2026-02-09 at 07:24 +0100, H=C3=BCseyin Demir wrote:
> Thanks for the patch and LGTM for PostgreSQL 18.

Thanks for checking!

> I tried to create following table on PG18
>
> benchmark=3D# CREATE TABLE two_not_null_constraints (
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0col integer NOT NULL,
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0CONSTRAINT two_not_null_constraints_col_= not_null CHECK (col IS NOT NULL)
> =C2=A0=C2=A0);
> ERROR:=C2=A0 duplicate key value violates unique constraint "pg_c= onstraint_conrelid_contypid_conname_index"
> DETAIL:=C2=A0 Key (conrelid, contypid, conname)=3D(16385, 0, two_not_n= ull_constraints_col_not_null) already exists.
>
> In PG17 I was able to create the table.

Yes, because what causes your problemm is a new feature in v18.

> One question during the tests should we confirm the output of pg_const= raint table ?
> It would make sense during the tests but the current test is also good= to proceed.



Yours,
Laurenz Albe
--0000000000002f6689064a674d9b--