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 1ueVkn-00AYZh-6E for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jul 2025 09:27: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 1ueVkm-001GWH-8A for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jul 2025 09:27: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 1ueVkl-001GW8-DI for pgsql-bugs@lists.postgresql.org; Wed, 23 Jul 2025 09:27:12 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ueVkh-000OVG-27 for pgsql-bugs@lists.postgresql.org; Wed, 23 Jul 2025 09:27:11 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id C4A8C1400BBE; Wed, 23 Jul 2025 05:27:06 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 23 Jul 2025 05:27:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1753262826; x= 1753349226; bh=UQbFCTC/LD26e0DPk6315LqHAbsEo8RBASsPgEmuIT0=; b=r 06yK74KatF9oUvHxg93zvqOj9zzbbta1Bx+Sp+HUGrlaqs0RahAOIq+1rlcGTBXB O0+vgxRai4jqtfC8v6/KqwVFmPqabsRpfqz/f8iOKNDqHXf2wL44ewtrh1uEhCqx Xz8ZHls6OWMNLRc9JBhCPx4nFYmeFCHBCNj5Av0cWTTjIJyO0NI88EgFo9A2Z7zI 6Y3NxvD6CF7kSz6Cz/hYrlnedE2a08hJHYrb8iIM2VarD6e9Nn1EgNE0zW3F2wlP gQS6TjHZ0as4DYMuzWlMfsvZ0FV1gQuykVC0GTj17QVrOPjF5DMh2p0Bp/3TMSAm +U3kVZ8uVs6TWU2UbY0uA== 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=fm2; t=1753262826; x=1753349226; bh=U QbFCTC/LD26e0DPk6315LqHAbsEo8RBASsPgEmuIT0=; b=KTR7YUtgO4+Bh8zE7 1YSwvHEsq7VlsAJKL2/k3ogfCj431J4YuzqGcZh72vNp83TWNv7N+e1awsUnWCsb Y1b3L1SEMbl8Lw7vG+0CNHwHUOOFXIAgVVjFFkDIvFvo3ZzYPQdip2E+39F/9UM9 7NDLEgkcAl8mRcNXO8QucwocKqlSEnmeJH5nAPvt96Lk0IWOsOc2gbhEvDopp5N8 RBAt9QGn0CL0vyCrbuWXQuIMxAF8p6sz8GtHQizLFcrau8Yc8J9B/AJ5R0ZDxhTv bVpm4NTmRbW4/8s8T+MFfxnvfZk35YBbogw6anJZCQYrwTMv8eaIgpsQ28IhMjpc 4MbrQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdejjeegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpemllhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgeqnecuggftrf grthhtvghrnhepkefgkefhgffghedvgfdtvddvieehveduiedtieehkeduhefgteetveek tdefkeegnecuffhomhgrihhnpehpohhsthhgrhdrvghspdgvnhhtvghrphhrihhsvggusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgdpnhgspghrtghpthhtohepfedpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepmhihohhnseguvggsihgrnhdrohhrghdp rhgtphhtthhopehluhgtrgdrvhgrlhhlihhsrgesghhmrghilhdrtghomhdprhgtphhtth hopehpghhsqhhlqdgsuhhgsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jul 2025 05:27:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1753262824; bh=jgEnjUy/zdzAOPAdSO/KQbi5XwaYpxIcwIw3el4XM7c=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Djb6OBUhnWlkDUTmDZNaY9TCvoubsT6WWhM4bU46UjsDVDIceqCVjaVvyUHTEfaqV /URqvs+9qeTGIL72F+mHDvOs7CR21MNv2tm1uIqcynSK2hGHR8zgRoaJvECzJ4hScL FLbdpoRShFeIggH+WCxDe4tF1hGGN/E6hoLQEDRbfB+3bVFEPvJLZy/Lr/PCq7cEz4 lTRtLIlT1xAD2G690qtoSe5ikf8GjvW/GY/l0OSe5pfxIck/TYqlnmsnzfcrM5WCqD cE6XEIrsOIJlTGN5hGc0nSlTMmfD2Gx0veCAX4gQpV+iEBuDvvsWbOw5bYcs5CYUGp 5Y/P83yJ9/B4w== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 9EFEF90; Wed, 23 Jul 2025 11:27:04 +0200 (CEST) Date: Wed, 23 Jul 2025 11:27:04 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Christoph Berg Cc: Luca Vallisa , pgsql-bugs@lists.postgresql.org Subject: Re: Self referential foreign keys in partitioned table not working as expected Message-ID: <202507230927.jnoadaq5v62v@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-Apr-01, Christoph Berg wrote: > Re: Luca Vallisa > > The provided version throws an error. > > Ok, I can confirm this. > On a partitioned table, it does not throw the error: > > create table test ( > id_1 int4 not null, > id_2 int4 not null, > parent_id_2 int4 null, > primary key (id_1, id_2), > foreign key (id_1, parent_id_2) references test (id_1, id_2) > ) partition by list (id_1); > create table test_1 partition of test for values in (1); > insert into test values (1, 1, null), (1, 2, 1); > delete from test where (id_1, id_2) = (1, 1); FWIW I didn't give closure on this thread, but AFAICT this is the same bug that was reported in https://postgr.es/m/18156-a44bc7096f0683e6@postgresql.org and https://postgr.es/m/CAECtzeWHCA+6tTcm2Oh2+g7fURUJpLZb-=pRXgeWJ-Pi+VU=_w@mail.gmail.com That was fixed a couple of months ago. The above script throws an error as it should. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/