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 1wQ2ID-001Ejo-25 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 12:14:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wQ2IB-00A4Nm-26 for pgsql-hackers@arkaria.postgresql.org; Thu, 21 May 2026 12:14:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wQ2IB-00A4Nd-1D for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 12:14:24 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wQ2I7-0000000061M-4AcR for pgsql-hackers@lists.postgresql.org; Thu, 21 May 2026 12:14:21 +0000 Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-51306c9f2e1so72990541cf.0 for ; Thu, 21 May 2026 05:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779365658; cv=none; d=google.com; s=arc-20240605; b=c5n8Ua+AytsQ7LJZ5vmtReCuVSscGlUEuz7+05cSzP0Vn+JCAf9l1tBOuyLyWyCf5+ 588EkwlzX/x1ahdoTT4Fva/FRFV88DrSEbg9Lt26eKjGNBl1Q3KCIKApcOvXlD5xmKXC JKN6+0WyWIRNskhlOYxVy0mPQH5IDvXIGe3SL3yHUR9nEyBm+4PJethPPd2aJMHgH3ZR udLhI6pcBz6mbQrVnCUd6z4MomFvc1TAx8l9748qb9tIIT2MGxow2dF9URkFwa5vdkmw 8xqfWFRvdjI7HZFG8HQ5m5u1U6WcnEMMoCVGZ4NxJfaJcIxTPak87ELmSPn2LFTP1sTh MOHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=0r9nDJHX5U8NPnBt0XzYkv63mC7sNTGatRO5Wm5t6XE=; fh=dxJXJbLzq9Nah1LUdsj4QTuQ3JoDScd0wp1YHY64NXM=; b=bm7x+80d0AK0L7rtJ9cs6X4B+v/OxxZa6k8+lcgCKfPqCZSfNgEJ+42Ge0HVcHgyGm c1xplcsekFGrOBlJsRVvklL+am3JpFg3VWrxqPm1vB+q7MBI6CcRhRrUNVXesyC30M2X dW9SEXQso5S/E8RRkDnMPpePq8G9YgZW4RkJQrvMnekG8sXsKW3OaS9KSTnfzeyqQ4UQ YneuJH9ueOdfH3lEFok6DkxpwriBYBuf/BwmPYkh4cptFv1TiB+fwNH4p8UnA/m3G8xj S8/1q+j2eiNqUMm28cNbNRnMRJVqTqSCUs3DiNX04/jFQGUxzRjZkP0LSntFqpP0nMl6 /jbQ==; 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=20251104; t=1779365658; x=1779970458; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=0r9nDJHX5U8NPnBt0XzYkv63mC7sNTGatRO5Wm5t6XE=; b=kYCAEEiXdQA+vjFQ5CxVD8tK+VBB4Vk1h0llhiN8O62C1KJnpZlzVRdeL4e8W//IgA 8Js3y7b5N5CKAbNP2IBwmiGCKMfmi55H1wJvw6uNj7mVmJUVolcWac0feUSXQyxhNeEX SrZar4WS7OEdBdXOWV//Ye0uECX32tjHKDRZDEcgKbiYDdLzB9Ch63k+ZamWpM1twgQg ZBi4G+pGJVow6+7oN8O1rrCNcTELAB88sAR5Uo+RGGpH6yvfykd+1D2m7Q+Gy5wEKwDE XSROlbjRVxcBY1rQ+h4W25KTEdKFEoZyGzm9xyBpYGBMw66NrUj3Mxx/MI8nOAECSIWd 0twg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779365658; x=1779970458; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0r9nDJHX5U8NPnBt0XzYkv63mC7sNTGatRO5Wm5t6XE=; b=tQ1RkLpZT0+HczfNlm677sM35jU+QPmYuVKsbUlhVY0QOCECPrXvA13BXJr5dTDvcj VN3jQj5pRwkHpiCVilUAAE56rdK2Ya8KKmOWKqlGFfCOSGlCaGrnotnicLl+4o9qD0Bk FV0lIdv0lFHrQsQ7J6lNy2ESRu0Lfv3b1FTdPTDbu1R6jZTIswijDLsiqD9uPi0B2mGL TC1VxkaJNtn5+XhskIigU5pNqvfRcB88z4FJGkrULjA//Lqq3X9g6xCAw9auTA2hLD7K rCWlbhKME5UVM/1nYRmwNwXCGcmuesHwQBTGHtqVo89EwjcjutCbiWgsHj360vjKLnUM 3N8A== X-Gm-Message-State: AOJu0Yw+6Q9JjjuVZ2UiV7JJErstIwn8IeL6oQnUe+DRkUWZMjWPva4E 9hLZ25XN+9br46kEZNVemnaR/aED1+7KkkaYck7M1FHOOpp2TkkAmBFU3kGe4jwQeqWjQqYGmal Nx3Yy6DRpJTVswt+Y9pfp00mfOyqOGRhOkg+7 X-Gm-Gg: Acq92OGz4Khfy0mQZTGNbpCuKyomy0rS1EeY3Jp/3U1B+mqmOhXvW5RtM0gjzEBbhj6 FCM9kDS/bO+jwqntM80vtd6idMjv9lXyiWt44Ry4MnhZNB34IDJjCeqyDGtu+EiI/rC9d58jfKv 7Gy5Ep+Gn7B7o+c5fap336JYGTkWleht2olHwdnmAyyxpjkvNFTUPx784EGSimZK+sM/rQcrVhm hFU8SeGQ7vbPbLo6Ezdx1Oia9fH737N0ZtbIMz98LR1kSFceBCoAb4WETu+ueBPiyOeixYIE1+s r3lD3d9nbSvi8LXzRzNpz9rhB50oleePTd2sbKCPilHrO+4mP88VjUQ7K1IuHFs1w5v4odecbqT DRE3v5d6cZCeyDLk9 X-Received: by 2002:a05:622a:4c0a:b0:50d:e471:2d1e with SMTP id d75a77b69052e-516c555b01amr30794281cf.35.1779365658543; Thu, 21 May 2026 05:14:18 -0700 (PDT) MIME-Version: 1.0 From: Kirill Reshke Date: Thu, 21 May 2026 17:14:07 +0500 X-Gm-Features: AVHnY4LV2m7OTDU25gOGqgRcyfShTcW-UT-AEOvFD_-un9v7aJI_znL7WFhWD5k Message-ID: Subject: Pg upgrade bug with NOT NULL NOT VALID To: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On pg 17: create table t(i int not null); alter table t add constraint t_i_not_null check((i is not null)) not valid; then upgrade to current master, will fail with ``` pg_restore: error: could not execute query: ERROR: constraint "t_i_not_null" for relation "t" already exists Command was: ALTER TABLE "public"."t" ADD CONSTRAINT "t_i_not_null" CHECK (("i" IS NOT NULL)) NOT VALID; ``` I think we need to fix this in the spirit of [0]. I'm currently thinking of choosing a less obvious name for NOT NULL constraint that is created during CREATE TABLE processing. Is that a good way to address this? This will impact non-pg_upgrade creations too, is this important? If so, I will share a patch on this [0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=3db61db48ef5b8898f7e85f98548fdec79d76524 -- Best regards, Kirill Reshke