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.96) (envelope-from ) id 1vvz6A-00DtLq-0g for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 14:45:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvz69-00456J-0V for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 14:45:45 +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.96) (envelope-from ) id 1vvz68-004568-2p for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 14:45:44 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vvz65-00000001aHs-3nb8 for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 14:45:44 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48069a48629so22891455e9.0 for ; Fri, 27 Feb 2026 06:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1772203541; x=1772808341; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=rnWydj7UwGdnoeAQ9KMb4d0mo/0HUm/LOghRCwmVHFg=; b=dztRHKQouqW98Kms7imFyht0RDfE6Sv2BRa2surtKu1Bky4r3OwPdoHXoquD4cCKNo ct7kGdkUhax08TZVx1Z1K34DQmpG6Yv9dbw7kowQTYOTNMPk86nrYewr6fp5xf2NjUvl CcLsvHBFUfMQhGRIWQ7xQk4eT2kCTBHC3Pu8QU1bcwB/5rqNW2cqhhYe8FJP2Q/v0JEX vaq6/pxThB7Fw/K5gmYq49xo+x4YiXBHLHF4VOr5Sa3xUKTW1vJYQj9Ya5Ci2X/DDb7V jxSg0i/Ra4kEAG6x4mw0BWvN+H0PVTBbkWjrbz9eTaK4JBrzCiD5RVtswoW/37XPq7vC PPew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772203541; x=1772808341; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rnWydj7UwGdnoeAQ9KMb4d0mo/0HUm/LOghRCwmVHFg=; b=r0g1BR4KlyjNcDD/TJdI10FaXEbr1LbyPS43RKEXLOk2hcIS/JRVAsacZMdY410eDX qCRjT+d8pAXEfxqiJXM++K5KXGnVf6qCtlUiQPC+jlvSZiajU7vHUZjkmiRjYlO1x2Ea sUGjA4t6AJT2XMCOtNxKr0HO8j11rHs0uQ/E7HhcdNqYLhdX4MYTQBi1o/maO2FcZGgz dP1n4AKnAn5zuVgCwUOw0Bf+C7D/xxKpeYyzhEMYH+lO8kjQHwgLUsy7+S4qMJWZRos3 9VohY2ONOvvdSuy4er+OGKAee2M1SC2yuGZhBBnaM8PA/XgxTO/0P8TI4i9SexWs1EvI Ymgw== X-Forwarded-Encrypted: i=1; AJvYcCV3PVS2eTrPDEAgZ6NSeSiYYjIfKUCIRS+ZLeUVm+VB1K6rYA4BxTyMiL/YPiyMwEl3FsNdsQsVI1mK@lists.postgresql.org X-Gm-Message-State: AOJu0Yw1G3oi1EdOtgzeYRoCxa4OIyu1riHmAEEwRyxKv70lj2E/pCew NHltx8rxVIQDeu+kvW+VcjOjpEVva6U6oWORtariCJ4xI+AvXuuptOQRkTjT0zgSHQQ= X-Gm-Gg: ATEYQzyZTEwBt397DCXQngPZKdm78tjuPMF41M/iR3jTLjBLNqXZocn7HWLfH6t1nlR NNqyINeDptIFkDRdfFOrRCocDvWWdyMk0OfP6q7zJuBxtO854LnrD2axmf0ifVMvZY0d2U4cmzE S+W2gYzbU42wIpgNDWxOfS4F1gMG72FuR0Zj8aMgyUtkhLeOq9wOnb+ovpZaOH0pf0xhdZ57cCj Po8oHbwZNbHMzjNV0kKWP9g5rgM/aOFiqCdzXSJHwUCDESgGeLRl9DXMjnwBguYR4QsPF+790q/ K/Ol/KK1udJnoi0s6o8GgeoqWSjEY32dboycbizDutCHePjF0Xlxpo4WXmiIvujgA/MQTl1isRy hd6/BUogwaHGpYYVOY+4sSB/n4ZmOVQnsAKC5VBUYCVwuiQ+XTZHi4c0OzXh2VVAl3OSqLDTh64 XR41Z7y36R8Vvgx9lTTCBzcH41ayq9od8gtwqq7fvofEI+NPXEeF1j X-Received: by 2002:a05:600c:35c2:b0:482:eec4:758 with SMTP id 5b1f17b1804b1-483c9c1532emr51779525e9.26.1772203540756; Fri, 27 Feb 2026 06:45:40 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:9a2c:17c4:94e7:857c:de9e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bfbb465bsm146999635e9.3.2026.02.27.06.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Feb 2026 06:45:40 -0800 (PST) Message-ID: <1b32a18349afe49d4cc605a91b8f900e4f9e1ad1.camel@cybertec.at> Subject: Re: BUG #19420: Zombie FK exists after partition is detached. From: Laurenz Albe To: a.chodkowska@gmail.com, pgsql-bugs@lists.postgresql.org Date: Fri, 27 Feb 2026 15:45:39 +0100 In-Reply-To: <19420-ec7f929dce3a7e14@postgresql.org> References: <19420-ec7f929dce3a7e14@postgresql.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-02-27 at 09:09 +0000, PG Bug reporting form wrote: > Logged by: Agnieszka Chodkowska > PostgreSQL version: 16.6 > Operating system: Linux, Debian 12.2.0 64 bit >=20 > I have child table with FK defined as folllows >=20 > ALTER TABLE IF EXISTS tst.child_test_1 > ADD CONSTRAINT child_test_1_parent_id_parent_part_by_fkey FOREIGN KEY > (parent_id, parent_part_by) > REFERENCES tst.maintenance_test_1_p20260218 (id, part_by) MATCH SIMPL= E > ON UPDATE NO ACTION > ON DELETE CASCADE; This is a table partition with a foreign key to another table partition, correct? > I updated configuration according to documentation as follows: > retention_keep_table=3Dfalse , > retention_keep_index =3D false These are not PostgreSQL configuration parameters... > Somehow postgresql retains the foreign keys of the detached/dropped > partitions, to the parent table partitions. That is as expected. partitions are tables in their own right and can entertain foreign key constraints to other tables, independent of their role as partitions of a partitioned table. > I try the following methods: > partman.run_maintenance('tst.child_test_1') > partman.run_maintenance() > ALTER TABLE tst.child_test_1 DETACH PARTITION >=20 > The error persisted regardless of the method used. I'd say that you have to drop the foreign key constraint explicitly. Yours, Laurenz Albe