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 1qdUHF-003bkg-Cs for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2023 11:31:26 +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 1qdUHE-001MqX-8Y for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2023 11:31:24 +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 1qdUFp-001IwT-7Y for pgsql-hackers@lists.postgresql.org; Tue, 05 Sep 2023 11:29:58 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qdUFk-003BDH-4U for pgsql-hackers@lists.postgresql.org; Tue, 05 Sep 2023 11:29:56 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 927435C00A1; Tue, 5 Sep 2023 07:29:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 05 Sep 2023 07:29:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1693913389; x=1693999789; bh=lkWpBVKO1o229QK6fhGUUlXd5 VIf0iCLSOnuJvid0p0=; b=HjIwevF/hGv8yTceRsLb6OZoSqczBvlmiM4hzJLRw C/6SbG5TiFw+0a2r7eAMAU3k1hPo7Xxw4lfh2deIGWuX/QUniyS3ZZvkaxijeWIz FsdpB+hSz/bX+Ry6ej4qFjbkuN+VRJO6DbJEqNfr1qbYU7Tuh+igjn5Jhd+3kDe2 oYjPFHZyJVNzNUtilj6iDHlxQjRRXT2jA5mL4sG5rMdhK0IpXDPqgSg3rU/bXzW8 arHbJxtq53S5pRkas19FL+rCatSgqaIu18JA8ROcI8ClENc1++Wlf4wMlYeqMan6 t2OOVuEJ4lIxcGtvVAAQBCSwp+ygf7dmWg5FJkUnLlPjg== 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 :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693913389; x=1693999789; bh=lkWpBVKO1o229QK6fhGUUlXd5VIf0iCLSOn uJvid0p0=; b=oSz+/ldwlQFZ3fQlaflhBp7Cis1OtMQvxY/oa3WtaqdfTOCo0/9 Gy1+R3Awc9b+cYSZ4xl0OQkd5xm5j6SeUsjxKJsS7tZyZ3sWpbsNS5uUBnElaU7L qIZind7x1tRlBy7kv0jOhHxcvZoO1H4PfkI2mv3ji5EEqvBhrnrDgepSsD1GUqb2 83dmekvWuVRwSjtqbacO9m4Ltk6vAsmoHlDbqr/83yH2y/LOdxuF7CsDdr+ybW1N DvKqTq2KLwZjvJpcRVSkOCHotgBnpGWPJnw9EjxNeZ0qE1lK22jMqGbbBvGShCiA fIjIX3DMLjZK0al+YoVScRw3kxgnLLC3zvg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudehuddgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgh eqnecuggftrfgrthhtvghrnhepheeiuefhleelfeeikeehkefgkeeggfevheeuvdejveet tdegleekffffieekuedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Sep 2023 07:29:48 -0400 (EDT) Message-ID: <471cd41b-c345-3bee-fe97-061f74eba5b8@eisentraut.org> Date: Tue, 5 Sep 2023 13:29:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: cataloguing NOT NULL constraints Content-Language: en-US To: Alvaro Herrera Cc: Pg Hackers References: <20230831100239.gzjmiovzabx2diuo@alvherre.pgsql> From: Peter Eisentraut In-Reply-To: <20230831100239.gzjmiovzabx2diuo@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 31.08.23 12:02, Alvaro Herrera wrote: > In constraint_column_usage, you're adding a relkind to the catalog scan > that goes through pg_depend for CHECK constraints. Here we can rely on > a simple conkey[1] check and a separate UNION ALL arm[q5]; this is also > faster when there are many tables. > > The third view definition looks ok. It's certainly very nice to be able > to delete XXX comments there. The following information schema views are affected by the not-null constraint catalog entries: 1. CHECK_CONSTRAINTS 2. CONSTRAINT_COLUMN_USAGE 3. DOMAIN_CONSTRAINTS 4. TABLE_CONSTRAINTS Note that 1 and 3 also contain domain constraints. So as long as the domain not-null constraints are not similarly catalogued, we can't delete the separate not-null union branch. (3 never had one, so arguably a bit buggy.) I think we can fix up 4 by just deleting the not-null union branch. For 2, the simple fix is also easy, but there are some other options, as you discuss above. How do you want to proceed?