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 1qdYsJ-003uko-9W for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2023 16:25:59 +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 1qdYrJ-003Gw9-AI for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2023 16:24:57 +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 1qdYrI-003Gvl-Du for pgsql-hackers@lists.postgresql.org; Tue, 05 Sep 2023 16:24:56 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qdYr8-003EEI-Am for pgsql-hackers@lists.postgresql.org; Tue, 05 Sep 2023 16:24:55 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E184F3200893; Tue, 5 Sep 2023 12:24:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 05 Sep 2023 12:24:42 -0400 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1693931081; x= 1694017481; bh=PPPkyLUOFR3hXXEZj2N53cBUl3q9oaWbJlbxKC8UuUE=; b=r p5ryZ5+ezNbRBhWBSWgbwluSBeDfknaH6pzqzSt/Xb7sFh//ecx+CfyG5zJUFI63 caBTmGdHPL2QkZlkOlGBQcO5FtJTuB/69ckxu9nEGWMDiaXgi0Uw+Y/Z1PpTzPKb Aio7QNcZiDc0Qhk8/9vlbgyEvV5taq/D0/Ob1jYUb2F+ttRi8rUgmfC3AF06zBM3 GIJG1yKTn/acBOStx8E23fA5z7Gfi3wm4WLAYnaUejqsKHEMGTwcfptAY4ZAqNU6 WSKkNP5ZAak4eqUSG1+HZYTTvJsywvC7sou9RBmm0eq2a4zARbLcB2qPQBmVECcE 5QKwPLEE1ZHKWDSUkABng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudehuddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Sep 2023 12:24:40 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 485AB426; Tue, 5 Sep 2023 18:24:37 +0200 (CEST) Date: Tue, 5 Sep 2023 18:24:37 +0200 From: Alvaro Herrera To: Pg Hackers , Tom Lane , Peter Eisentraut Cc: Peter Eisentraut Subject: Re: information_schema and not-null constraints Message-ID: <202309051624.hrzj5uy3dmg3@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <471cd41b-c345-3bee-fe97-061f74eba5b8@eisentraut.org> <1196274.1693860187@sss.pgh.pa.us> <202309041710.psytrxlsiqex@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Sep-05, Peter Eisentraut wrote: > 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. After looking at what happens for domain constraints in older versions (I tested 15, but I suppose this applies everywhere), I notice that we don't seem to handle them anywhere that I can see. My quick exercise is just create domain nnint as int not null; create table foo (a nnint); and then verify that this constraint shows nowhere -- it's not in DOMAIN_CONSTRAINTS for starters, which is I think the most obvious place. And nothing is shown in CHECK_CONSTRAINTS nor TABLE_CONSTRAINTS either. This did ever work in the past? I tested with 9.3 and didn't see anything there either. I am hesitant to try to add domain not-null constraint support to information_schema in the same commit as these changes. I think this should be fixed separately. (Note that if, in older versions, you change the table to be create table foo (a nnint NOT NULL); then you do get a row in table_constraints, but nothing in check_constraints. With my proposed definition this constraint appears in check_constraints, table_constraints and constraint_column_usage.) On 2023-Sep-04, Tom Lane wrote: > I object very very strongly to this proposed test method. It > completely undoes the work I did in v15 (cc50080a8 and related) > to make the core regression test scripts mostly independent of each > other. Even without considering the use-case of running a subset of > the tests, the new test's expected output will constantly be needing > updates as side effects of unrelated changes. You're absolutely right, this would be disastrous. A better alternative is that the new test file creates a few objects for itself, either by using a separate role or by using a separate schema, and we examine the information_schema display for those objects only. Then it'll be better isolated. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Subversion to GIT: the shortest path to happiness I've ever heard of (Alexey Klyukin)