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 1tDRC5-000gvf-VY for pgsql-general@arkaria.postgresql.org; Tue, 19 Nov 2024 16:35:14 +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 1tDRC4-00EdIi-9v for pgsql-general@arkaria.postgresql.org; Tue, 19 Nov 2024 16:35:12 +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 1tDRC3-00EdFa-EF for pgsql-general@lists.postgresql.org; Tue, 19 Nov 2024 16:35:11 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDRC0-002mK5-DQ for pgsql-general@lists.postgresql.org; Tue, 19 Nov 2024 16:35:10 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9BFD01140195; Tue, 19 Nov 2024 11:35:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 19 Nov 2024 11:35:06 -0500 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=fm3; t=1732034106; x=1732120506; bh=e a7yBlPcKZpwsH+TVtG0VRBPv613N07gEmBCbVfignM=; b=OYChoMo5BD2BxXWzY H7acazweKYNgVCbBMeH+O5OO/C02jLzZZFUsMfMJ0mEZUH2NlAYvEnXr0McUF1Os RXJJldUnDm4i7APzLwvembsfxU8OB0BQrDdTdWfX+7hZ8SnipKng4adCsLGlzCiQ dTHdt2rX/4TbNno3phEwgYOJBpM+0/QjOCPpPs/UtqaV3natTtJO4UszJzBKitHK VDMZou6yiRFYZw/2j6rc7gp5oDgiRl+gsDwNg/tiXsJJP+xx8dmtm8UOdnmqK7De DFTHSiji7C2CQdZhFV7JHhKVeGSKG2MEzKhHXWBEHiZSesQYz1xPgu8gu3kHjXAE /USZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedvgdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecu hfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrd hnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfej jefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprh hishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtg hpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgruhhlrdhfohgv rhhsthgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrg hlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Nov 2024 11:35:05 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1732034043; bh=cAXjPx4zt1r/e/X7OBfAfA5zfX1RTjJYXLMNO6w5obM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=QLMHTHPweobHf0EcjVgn7StLrl0V5iKmK97lFqEM3Jl6gUqUo5Y0e+dOauL/LkWDz hxi2hE9dI8ALQqMrCve7cW9VEML2uHclnCwGGdoEBtSXyk60dDHtlhQV+N19MxZ1Iv 2zwmzJSXwPWnYxAO6bsnr0ZRPlIvsfk68aIsolsvnxC9og9y7MFgtuKOMcf2xIUzYA C6QcB+DENHDshU3lZ39eE5Ald9+aq27URUgaJYs19jDC8/iEnDORxbpceCgWFGrDXY 41Tulxbs3vhBDyk3ovgthpPVPjC04hQ5QrKH8zbzDAuwKHqlzFQAH0atQQqjelYDVv We4q6XfT3hwRA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 96351E3; Tue, 19 Nov 2024 17:34:03 +0100 (CET) Date: Tue, 19 Nov 2024 17:34:03 +0100 From: Alvaro Herrera To: Paul Foerster Cc: pgsql-general list Subject: Re: PostgreSQL 15.9 Update: Partitioned tables with foreign key constraints Message-ID: <202411191634.vexoqghfj2aq@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 Hi Paul, On 2024-Nov-19, Paul Foerster wrote: > the PostgreSQL 15.9 release notes instruct to look out for especially > detached partitions with foreign key constraints. I'm in the process > of updating our databases from 15.8 to 15.9 now and found a case where > the select statement returns a constraint. > > The release notes say nothing about when to fix that using the > generated add or drop statements. > > Do I want/need to do that before or after I exchange the software? And > if it is to be done on a particular of the two releases, why is that? It doesn't really matter when you do it, because the constraint only gets broken by running DETACH with the old server code. You have already run the DETACH sometime in the past (that's how the constraint got broken), which means you would not run it again now to the same table. The old server code will behave correctly when doing ADD / DROP constraint, as will the new server code. Feel free to run it when it's more convenient to you. I'd advise against running ALTER TABLE DETACH until you have upgraded, however -- at least, for partitioned tables that have foreign keys pointing to other partitioned tables. Thanks, -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Postgres is bloatware by design: it was built to house PhD theses." (Joey Hellerstein, SIGMOD annual conference 2002)