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 1tbDV8-008yYs-C2 for pgsql-committers@arkaria.postgresql.org; Fri, 24 Jan 2025 06:49:10 +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 1tbDV7-00BK4j-EE for pgsql-committers@arkaria.postgresql.org; Fri, 24 Jan 2025 06:49:09 +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 1tbDV7-00BK4b-2f for pgsql-committers@lists.postgresql.org; Fri, 24 Jan 2025 06:49:09 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tbDV4-001DnG-2x for pgsql-committers@lists.postgresql.org; Fri, 24 Jan 2025 06:49:08 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id C523D2540187; Fri, 24 Jan 2025 01:49:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Fri, 24 Jan 2025 01:49:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1737701346; x=1737787746; bh=klVz4NZ/s5 PvbZHbNYmp+IRzl105W4K5kE4fHvn0VRQ=; b=I8i/sLEu0XhyEDs5yoqtKkGz4F LnHiDNj2v1eZ9OQlrLNoh+0uJEUFp7mztH4rI2WQ4J4utQOBd+R/grJ0G+wrgQgW xjuSyJ78Ir9gAR3QQROxDrWgz/6oDpUMMNRSzf2kDtATbWi1+J3TA14jagpW5cdn 80Y4mmW0L4V80/vUoIwPHpSCmnIV+GAGQdAY++r7T0UMIN3eaFT9ICsghTXBqqZy PvFnwiUrs141zLAMC+PUtczeVDDYPlFMLwWsjw34ltWd775Tr51plmG/tSlTblE9 jrsvU8FsoujnqpntMxBjb1YqkgyiZti/dWU2NZdGnmytVCTUzeLEaR5TVvSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1737701346; x=1737787746; bh=klVz4NZ/s5PvbZHbNYmp+IRzl105W4K5kE4 fHvn0VRQ=; b=zN+Hj2UWh3TXFDv+Pk13GUXaaraZ9H2q0PwwW6lbjMhPfCEZA7u ehdEWQoZ4df6tgQiZyGKyumpqZHHWXihzkxkTWym3H3uPAfK5Ti7WLQjaCPawI8u rArmNE64c580cRhNK0DLt5/YwPYWFk9nYYTEsb9I0GUaaJkwQezk9osCITSlAuae ENfkikHVIwnykbgSSFIOlgrOlLUIlDYxNiPh09YCJ+MkiolVpe3+p5oXDBhBmcIK tJPQaSPUEL0lxkzKpRZwh740zb4NqwIzaCTGzAbBmpVZD+JwpK/Qk+7kDA8wi9oo evJoExTw9i7ElXQA25PwPOKQZl7ZUoqd+WQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgfeekhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculd efhedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhep ofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighi iiqeenucggtffrrghtthgvrhhnpeegffejvefgveduvdejtddvtdeijeehudeuledvudef tdfgfeejvdekveekiedvvdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghh rggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepvddpmhhouggvpehsmh htphhouhhtpdhrtghpthhtoheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhr ghdprhgtphhtthhopehpghhsqhhlqdgtohhmmhhithhtvghrsheslhhishhtshdrphhosh htghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Jan 2025 01:49:04 -0500 (EST) Date: Fri, 24 Jan 2025 15:48:54 +0900 From: Michael Paquier To: =?iso-8859-1?Q?=C1lvaro?= Herrera Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Allow NOT VALID foreign key constraints on partitioned tables Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="R8LLOdefNA/arVOV" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --R8LLOdefNA/arVOV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alvaro. On Thu, Jan 23, 2025 at 02:59:38PM +0000, Alvaro Herrera wrote: > Allow NOT VALID foreign key constraints on partitioned tables >=20 > This feature was intentionally omitted when FKs were first implemented > for partitioned tables, and had been requested a few times; the > usefulness is clear. >=20 > Validation can happen for each partition individually, which is useful > to contain the number of locks held and the duration; or it can be > executed for the partitioning hierarchy as a single command, which > validates all child constraints that haven't been validated already. >=20 > This is also useful to implement NOT ENFORCED constraints on top. morepork at [1] is telling that these two queries are missing an ORDER BY to ensure a proper ordering of the output generated: +-- Constraint will be invalid. +SELECT conname, convalidated FROM pg_constraint WHERE conrelid =3D 'fk_not= partitioned_fk'::regclass;=20 [...] +-- All constraints are now valid. +SELECT conname, convalidated FROM pg_constraint WHERE conrelid =3D 'fk_not= partitioned_fk'::regclass;=20 [1]: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dmorepork&dt= =3D2025-01-23%2023%3A35%3A57 Thanks, -- Michael --R8LLOdefNA/arVOV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeTN9YACgkQnvQgOdby QH3t/Q/+KdXtnQn2v9DX0yHhTUxfqC0O41U5XE1nWvWgAc4OERrCRuBeAgQdM1Ma tUnFTp7JmXv27MQkXmpee4wy21ETSSWYqLQRW+Ow2UAgQ9oSiZgJqAoM6dDX1Mg1 nScA8wHHBYJ6FjNMR5mvoiMhL71p7ukChbNWH1cx8TYNXMXPb4aqClAlTSj6JChD D0AtcwO9GV2J9ZdpbnPdh5fGC8OCe6JObJxDBjJUlaZaADm9xEBOzNXb1BDY1MYB MUGH2A12B+Otr0Uj6DG4wLn14p3vWu6qS79MAWZAIVpxdwsPJx+pwS4xwObBjb8C gTkgaz+DP0Durus35tFQKMoIIAdNCnbJL/Nq6cLo14z5Jv6YvjAYXdVB339DCkJM hjoQZdqYUgluA6j7cXKvFovkdEJ3MLuZZMl9VNC3cs4NfXbSCJyXvd6mEO/J0138 1Ojghy4lVI70rjmlM/9A6HE8EB8UQE2KAzmcI6l3EmEqkBK5rjmLdl3Z+MHfBN0x fy09uC4o5f0gN920gvWktB92rbixJB6GsSRMsaxJr+Hyuewr1gk69R7GeSXDTYJ8 0ZSQY33LvA6llJlRK3YEx2hD1VuDOI2DCVYeX3sCQZ4zKf25803WqcCM08rj6YTi zmQgrpsr7OX8L5zgZMkTn9XGogtL1DN1bgfT3TmUJZ0AfRpYeps= =ulYi -----END PGP SIGNATURE----- --R8LLOdefNA/arVOV--