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.98.2) (envelope-from ) id 1xPjB7-00000000rgR-16Z1 for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2026 16:22:06 +0000 Received: from localhost ([127.0.0.1]:57128 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPirG-000000049ly-0DIC for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2026 16:01:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:41992) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPi4U-00000003ivs-1Xm2 for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 15:11:10 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPi4Q-00000000rBl-3wVY for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 15:11:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=qYuwvY3YGRb4urJYFgd+NDNvhbEsDLaZkfFpahMU6lE=; b=5hdllv1MMmPR5B/L+JjksVRbOY kWj5DLSJAYwRSxpgXG2fRpYYNTMfQMHTgAGzRje+8D0ZEeQFK2e/Va/ZaSNk7uewijQldan1/wxqj VCJA1WnKC9bluNn4prADMhIAqBIXXUWJi7ICTu6yGzwE320rsxOfC8iEu8BJnXjtvYm1+/iCsxvO3 jG7c5/qrbiQxfeIch1wGX7QryUzS2dyzkEFdwc1Sn1qdqb5VWoW1uVGDK5Sz9eRWFBkhgxqYMJ/SG 6uNvmTHQ8e2ZxciA7aZwRHECstOL7W9xOKEbath7K3UM8p87dJ7BE6d+jr75Zb7BX4Vum26tKi+7W bdSQeOew==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPi4P-000000021co-1rKI for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 15:11:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPi4N-000000056P1-1vjA for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 15:11:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19846: dump/restore marks inherited NOT VALID not-null constraint as local To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 125atishprak@gmail.com Reply-To: 125atishprak@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sat, 07 Nov 2026 15:10:48 +0000 Message-ID: <19846-abd715e593eba809@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19846 Logged by: Atish Prakash Email address: 125atishprak@gmail.com PostgreSQL version: 18.6 Operating system: Linux x86_64 Description: =20 A child's not-null constraint inherited from a NOT VALID parent constraint comes back with conislocal =3D true after a dump and restore. The child then beha= ves differently when the parent's constraint is dropped. CREATE TABLE np(a int, b int); ALTER TABLE np ADD CONSTRAINT nb NOT NULL b NOT VALID; CREATE TABLE nc() INHERITS (np); SELECT conislocal FROM pg_constraint WHERE conrelid =3D 'nc'::regclass AND conname =3D 'nb'; -- original: f restored: t ALTER TABLE np DROP CONSTRAINT nb; SELECT attnotnull FROM pg_attribute WHERE attrelid =3D 'nc'::regclass AND attname =3D 'b'; -- original: f restored: t Expected: the same result before and after the restore. A child of a valid not-null constraint does not show the difference in conislocal. Partitions are also affected: a partition of a table with a NOT VALID not-null constraint comes back with conislocal =3D true in the same way. pg_upgrade from 19rc1 to master changes conislocal in the same way. I have not written a patch or traced the exact statements responsible. Found with dump and restore differential tests. I reproduced and checked the result myself.