Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYYc3-0002Qx-56 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 20:03:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYYc2-0005oh-1O for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Sep 2022 20:03:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYYc1-0005oY-O5 for pgsql-hackers@lists.postgresql.org; Wed, 14 Sep 2022 20:03:57 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYYbz-0001px-7s for pgsql-hackers@lists.postgresql.org; Wed, 14 Sep 2022 20:03:56 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 3621E3200ACF; Wed, 14 Sep 2022 16:03:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 14 Sep 2022 16:03:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1663185831; x= 1663272231; bh=Vs7/gJ8BHw4JY+A0SJR162f3m2fbrEJ4sDq9Kak/z/k=; b=W 5UE3VAw8N1naCb4E5KT28guWf8QksZtaOvBW9IHWCbNLUvaC4NZVZDV+s5WzH1PR hmC6prh704bXnzAmOKIVlzkfmVcpyxDQJJFHgzaxwGUFNsssKeGP/u8Q9/PaMrip v4rQm7Fv9bmtXIpLLx/XtUYYZbvGHr3NZw5KnVnw7n6sNlzcwZWUU7qZwdBVZZ2m dDsTYKMZ9IW4eFnbBxMBf/05AYr4y4ExzaaP+gKcMtuDztKbeHWNhART5bNosEcN QmPDGVC/mZ5mIgTzs1oL3oCn3W1j8f1pzRQSe0a3Mi3iT2C1C3E6JnsBzbUrxmH+ 2udsgyxhicko8GUmjW8mg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeduiedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnh htvghrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepheelffeggedujeet iefhleetuddvieffhfffvdejvdffgeejkeduleduheduieefnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgr uhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Sep 2022 16:03:50 -0400 (EDT) Message-ID: Date: Wed, 14 Sep 2022 22:03:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: cataloguing NOT NULL constraints Content-Language: en-US To: Alvaro Herrera , Amit Langote Cc: Laurenz Albe , Pg Hackers References: <20220909175813.vu5kd2m67mrrqkjv@alvherre.pgsql> From: Peter Eisentraut In-Reply-To: <20220909175813.vu5kd2m67mrrqkjv@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 09.09.22 19:58, Alvaro Herrera wrote: > There were a lot more problems in that submission than I at first > realized, and I had to rewrite a lot of code in order to fix them. I > have fixed all the user-visible problems I found in this version, and > reviewed the tests results more carefully so I am now more confident > that behaviourally it's doing the right thing; but Reading through the SQL standard again, I think this patch goes a bit too far in folding NOT NULL and CHECK constraints together. The spec says that you need to remember whether a column was defined as NOT NULL, and that the commands DROP NOT NULL and SET NOT NULL only affect constraints defined in that way. In this implementation, a constraint defined as NOT NULL is converted to a CHECK (x IS NOT NULL) constraint and the original definition is forgotten. Besides that, I think that users are not going to like that pg_dump rewrites their NOT NULL constraints into CHECK table constraints. I suspect that this needs a separate contype for NOT NULL constraints that is separate from CONSTRAINT_CHECK.