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 1tsKiv-000rsP-8s for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 11:58:09 +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 1tsKit-003bxV-KA for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Mar 2025 11:58:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsKit-003bwz-8e for pgsql-hackers@lists.postgresql.org; Wed, 12 Mar 2025 11:58:07 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tsKio-002Pqm-1v for pgsql-hackers@postgresql.org; Wed, 12 Mar 2025 11:58:03 +0000 Received: from phl-compute-13.internal (phl-compute-13.phl.internal [10.202.2.53]) by mailfout.phl.internal (Postfix) with ESMTP id A40E81382D86; Wed, 12 Mar 2025 07:58:01 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-13.internal (MEProxy); Wed, 12 Mar 2025 07:58:01 -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-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741780681; x=1741867081; bh=0 CaHNzrM9N47rnJlpVqjW9kjmCFTcHlYu6H4N/0X8iQ=; b=aQPt3vD7FgzNjsl96 BfZAmsWgMDEu80id+pjKLS4jVTGV1e9GB0xeNYy/BlKvfGBtI+mX8Pu7Fz/iFLB8 /jRcAgheDaOM7fdLFgm/LMENO+r9G1Wq0sC9vJC79QSlEqmJKY6cRluJoQnkBadL oYlUZWjF0/27IzQmi0tRB2+26XBiyi5w9SZ1mS8yAmrRDlkaur+GedOs9PLMcYeO mVUEFIgZeco8wi5TzjB+oOEiKTMFBOLlDPk5HCKk8As9k1999AkvkWBeswtT+4Vs KFLX7x9BVaDonHx4lSq+mP1NgJhUZFpQ2vP0Hz/kiw4FhyBKeYXrlY050gSkB1Vz E8hGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdehtdduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddt jeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffeh fffhjeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvg hrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsg gprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrshhhuhht ohhshhdrsggrphgrthdrohhsshesghhmrghilhdrtghomhdprhgtphhtthhopehruhhshh grsghhrdhlrghthhhirgesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhh rggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Mar 2025 07:58:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1741780677; bh=X44g4jA1rk43ubQjUWcA9JQeRTiRMY7CUv8NBvguKUY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=m5DF3M3tewArZRGa/slgpwm7ikhFiz0Fgjvbco58984qKtVICHli2q9F+jfBa9LRr gPZP2xESsAGAOGfZ3WlkcLkMtbmiAPwpMxYkLn1CfOSCpMVqLO/fhTbOCrZiLX7Im9 AiGH/xcFfGEo2oZ46nW36UmAn/KxLhpPVpAp4A9LF74fDDT4HklH4vMr4O7CpKklP2 qV06D6mqsJRwYteVU8UXU998x2fhfpYLnYdYp1mzewx4kPcPl0db7ublKhoaJcwMpP lHv5f3baPGVkoyXrAvP+9U6Zmqp+QzIz+gSOLeAATmFJP4F0P+rX1kJsDiNJnKiboi gyEhBJbl9gsPQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 6A5B191; Wed, 12 Mar 2025 12:57:57 +0100 (CET) Date: Wed, 12 Mar 2025 12:57:57 +0100 From: Alvaro Herrera To: Ashutosh Bapat Cc: Rushabh Lathia , PostgreSQL Hackers Subject: Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints Message-ID: <202503121157.3zabg6m3anwp@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-Mar-12, Ashutosh Bapat wrote: > The 002_pg_upgrade test passes with and without my patches now. But > then the tests added here do not leave behind any parent-child table. > Previously we have found problems in dumping and restoring constraints > in an inheritance hierarchy. I think the test should leave behind all > the combinations of parent and child NOT NULL constraints so that > 0002_pg_upgrade can test those. I agree. > Is it expected that a child may have VALID constraint but parent has > not valid constraint? Sure. Consider: if the parent has an unvalidated constraint, we cannot make any assertions about the state of its children. The children may have additional constraints of their own -- in this case, a child can have a validated constraint even though the parent has none, or only an unvalidatec constraint. But the opposite is not allowed: if you know something to be true about a parent table (to wit: that no row in it is NULL), then this must necessarily apply to its children as well. Therefore, if there's a valid constraint in the parent, then all children must have the same constraint, and all such constraints must be known valid. > Same case with partitioned table. We should leave partitioned table > hierarchy behind for 002_pg_upgrade to test. And we need tests to test > scenarios where a partitioned table has valid constraint but we try to > change constraint on a partition to not valid and vice versa. I think > we shouldn't allow such assymetry in partitioned table hierarchy and > having a test would be better. Agreed. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/