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 1s5jDF-007mUn-TJ for pgsql-hackers@arkaria.postgresql.org; Sat, 11 May 2024 09:40:18 +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 1s5jDC-004WFi-BR for pgsql-hackers@arkaria.postgresql.org; Sat, 11 May 2024 09:40:14 +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 1s5jDB-004WFa-02 for pgsql-hackers@lists.postgresql.org; Sat, 11 May 2024 09:40:14 +0000 Received: from fout3-smtp.messagingengine.com ([103.168.172.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5jD5-000UYr-O6 for pgsql-hackers@lists.postgresql.org; Sat, 11 May 2024 09:40:12 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id C380213814A3; Sat, 11 May 2024 05:40:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 11 May 2024 05:40:05 -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:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715420405; x= 1715506805; bh=G581Kk7aqMrwyJRKuBvRP1YcAr+trCybd4ZFgbnUDJs=; b=f n9e08Vsz9DTg4cxGr+8U8nb5/BPHRRIxCILEGVICgu0bYvByBmeKv7t0qs2u3jbU 4OPlMX3v+zACionZIvR8iUaXrrPN9mKMepPfvRQEwIp06VA92HfKGOrqB0YKmCIp RvlJ5o1CSp6EWrdlCKfd9X6C1IjdNbo5yGCQMGQKSPEvFEkiz9OWKSPfDF6biTio yKVhuonlK7KeumwHSM0e/GxO5RZu5YxsPuiK90p6NQ6G5ghOmhgUk63Jy967pEex DLZTRkNQIMW6BHn2bKHQum0JE56c1oCJmQzchMna3WO3TDYrlBU9gUIvX66gcHkr X5imvatdkmLS8aRK/VSVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdegtddgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 May 2024 05:40:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1715420401; bh=Usxej9EVaZsRgzvt5GHpGFL0XdovL2IVGwnUJRUp9iY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=cY8yiMdHH6ZrATqqSFmTrcFwL5bqc6yLqZ5I8SEkvrxoxCd9p187GUViTK7fWOXuM xVwzrUuzXdnNVrzVMrigTV/X6fDpBeWlKBiiPMBSayweYNBFv1kgfVlKvKjkU/f8bI HXut92W/6cqo1chZhNebwcF8ZZzRRVyaHSEKQTL0eKYmVuESh2+01kQeI+rOAxRH3b 9PcrsrNE4Wcl0rfjgrlS1ddXrFeRMlCgM1nR4LIzoXEw1fTgCLYiGfpIvQBfRMcESQ Eo1y+lEppDxrWj2/XKpstqZuTTV4PDqTU+WOLnplmVlEtiQFNZ3nSWa6Kgwzs97KAv B8JFNxwM/mEYg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 5755FF1; Sat, 11 May 2024 11:40:01 +0200 (CEST) Date: Sat, 11 May 2024 11:40:01 +0200 From: Alvaro Herrera To: Robert Haas Cc: Kyotaro Horiguchi , exclusion@gmail.com, dean.a.rasheed@gmail.com, andrewbille@gmail.com, peter@eisentraut.org, pgsql-hackers@lists.postgresql.org, Justin Pryzby Subject: Re: cataloguing NOT NULL constraints Message-ID: <202405110940.joxlqcx4dogd@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 2024-May-09, Robert Haas wrote: > Yeah, I have to admit that the ongoing bug fixing here has started to > make me a bit nervous, but I also can't totally follow everything > that's under discussion, so I don't want to rush to judgement. I have found two more problems that I think are going to require some more work to fix, so I've decided to cut my losses now and revert the whole. I'll come back again in 18 with these problems fixed. Specifically, the problem is that I mentioned that we could restrict the NOT NULL NO INHERIT addition in pg_dump for primary keys to occur only in pg_upgrade; but it turns this is not correct. In normal dump/restore, there's an additional table scan to check for nulls when the constraints is not there, so the PK creation would become measurably slower. (In a table with a million single-int rows, PK creation goes from 2000ms to 2300ms due to the second scan to check for nulls). The addition of NOT NULL NO INHERIT constraints for this purpose collides with addition of constraints for other reasons, and it forces us to do unpleasant things such as altering an existing constraint to go from NO INHERIT to INHERIT. If this happens only during pg_upgrade, that would be okay IMV; but if we're forced to allow in normal operation (and in some cases we are), it could cause inconsistencies, so I don't want to do that. I see a way to fix this (adding another query in pg_dump that detects which columns descend from ones used in PKs in ancestor tables), but that's definitely too much additional mechanism to be adding this late in the cycle. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/