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.94.2) (envelope-from ) id 1v1iYh-00Blyg-Gf for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Sep 2025 09:46:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v1iYg-001cBt-4n for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Sep 2025 09:46:38 +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.94.2) (envelope-from ) id 1v1iYf-001cBk-CR for pgsql-hackers@lists.postgresql.org; Thu, 25 Sep 2025 09:46:37 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v1iYa-002mwM-1W for pgsql-hackers@postgresql.org; Thu, 25 Sep 2025 09:46:36 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 468321D000CA; Thu, 25 Sep 2025 05:46:31 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Thu, 25 Sep 2025 05:46:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1758793591; x= 1758879991; bh=Yv6Kr/whdZDjRgrwSTId/TlwC+lfuVLAGtUrHhz+UEI=; b=Z pqeSaCarjrEmOeTbVQuFizoR+G45PQVtkIIWECfHAFMwoDoFZzG1j61UxuT8Ohc3 M1DASC069FZWzgsCzZkZvnGE9n3AS9IcVidj0FBz1gZ3OHzbGsZ81F7DXifdHz9N m1CCkimN6FKWPfJs8KjJk18E6Kx3RqXy2Q/rjpOxO0NGprPy2EifSvEijDbCjZNM WQ8vwQKBH5EYH7+Z7jLAESiVXtKUu9HL/XjmXkrOhnDXmfQVTnrsYu+R1DxYhda5 bUsIRgA8271Am4Imra9lYfUt4QqRHd2LWAXGlqr/7KTCveKu+fDY09E9vPiPlp2G AVUlFO9RBC+/vZhWFE8sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1758793591; x=1758879991; bh=Y v6Kr/whdZDjRgrwSTId/TlwC+lfuVLAGtUrHhz+UEI=; b=hSJLyh+lZ16NeYZET NybgYSm1/mwwswYmCR63hSAgMcV4TUG12lqLWeSXkJk+BCGoeNtAEHY1Pkbh6L4J lndZC9Ky3XEfD2Itsxq2FOumNKwjSg4s3ntIe7qFiHSVsu4Y349XUUQ0zzz2s2Vc UniOwRmQ3jdYrj1tcfNm7ZYv1qZdSuO842Qa08C5k9gCBFS1jPGS4M2ln+gboMGh T5cZVnncniFEdbjteSRy92JtCFGwt01K40yZiA1XkIKQ/sA5hjCYKzrWqVt3oP94 JCrPw93EpKPc7zAJDl58t3M/WA3YCjqwckRAqaZK24Xa0ni6N9UvCcKyFyI6qamy ZcP0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdeiieduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkgggtugfgjgesthekredttd dtjeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehk uhhrihhlvghmuhdruggvqeenucggtffrrghtthgvrhhnpeetuedvheffkeevgfeuheevte evkefggedttdeufeeuheduuddthfeffffhjeefffenucffohhmrghinhepvghnthgvrhhp rhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvpdhnsggprhgtphht thhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjihgrnhdruhhnihhvvg hrshgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghk vghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Sep 2025 05:46:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1758793588; bh=trJaAqSkfyw98fnz+RPV2wy17fLIN7u+4DCOy3M7H1M=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=KOQdYuVXKanIPMpOotXztXQ6RWdYaZNEfgUEtEUki8DcLIaXYv15Ajok6MFYuV0+J +pVgSLXvQXwyi9Okpf0zcZ9YNHQ8FREL7d6D75214IIZZrN65Y4U2N2RLayzYRAoI7 qaiTpB0qtjV4Bos/MMOtblEpqwhPtVpCsqVNk1nUX4JVdCmRP6Ts5eGCakJtEKQUGf hP61Vz5ujAvViD/YvTYPIKXkLbx+O5/njLAwfdmKgtAf6+alnpkv4h8kNWld3VCqag mbdYzy8zyZ4uuBEN+jJcfnOy/x74B3B8kTCFA8rbGwXv2BZyHqRj/fcQlV5Hb0hWwf ODrgOe5rkf7Vw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id C086471; Thu, 25 Sep 2025 11:46:28 +0200 (CEST) Date: Thu, 25 Sep 2025 11:46:28 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: jian he Cc: PostgreSQL-development Subject: Re: NOT NULL NOT ENFORCED Message-ID: <202509250924.hyz33zhcwl7d@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Sep-24, jian he wrote: > currently NOT VALID NOT NULL dumped > constraint separately, NOT NULL NOT ENFORCED constraints can also be dumped > separately. > > CREATE TABLE tx3 (x int not null not enforced); > > can be dumped as: > > CREATE TABLE public.tx3 (x integer); > ALTER TABLE public.tx3 ADD CONSTRAINT tx3_x_not_null NOT NULL x NOT ENFORCED; > --------------- > note: currently not enforced check constraint is dumped separately. Hmm, I wonder what's the reason for this. Seems quite useless. Why wouldn't we dump unenforced constraint together with the table? The case is different from invalid constraints, which have to be created after data is loaded. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/