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 1qqXE6-00Arvk-5K for pgsql-general@arkaria.postgresql.org; Wed, 11 Oct 2023 11:18:06 +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 1qqXE3-00F8Tj-KH for pgsql-general@arkaria.postgresql.org; Wed, 11 Oct 2023 11:18:04 +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 1qqXE2-00F8TW-EM for pgsql-general@lists.postgresql.org; Wed, 11 Oct 2023 11:18:04 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqXE0-0017J2-K7 for pgsql-general@lists.postgresql.org; Wed, 11 Oct 2023 11:18:02 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AA92E5C0148; Wed, 11 Oct 2023 07:17:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 11 Oct 2023 07:17:59 -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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1697023079; x= 1697109479; bh=awfMU/CQOSMeCxLU3dZ4tSd2Yr4TsoSrqlCCu3Ke7cE=; b=p 2gF4fk3dzRrmHKdYZqBB8kM5GrETy/kU0zUKdoHijXY8lOXwKiXYc15pCEQjGPhH qjoAkat5xXKWq+HgZ4eb09ed2TYftS6IzwMgXC1ksxamxwDOaZWmqDQxqcgi2noX wrbQL7i6nvhTEUk3Ymtw9CRixBhjtbtI4j8+il4UoXKGnJNAWXVGt/fhxVRTuJx6 D8K+I1OmuN6tOJOtzQwB1W8MIwHd3GNLpSAVhip/VKS7kRyUktgZrA5GrhCcdfwI tzJkDKB3mvUdE5gAYCHkKps0pME3UIOrxA0X0WfZhNlfUYQDKxTxhAKjI09KlDQz wW/Bt1vqvO/PtBqbt8tlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrheekgdefiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedtgfevueeggefhkedvieduhefgveehjeeijeevveeuiedv ffdufeethedvtddtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Oct 2023 07:17:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1697023077; bh=zW05jlrqPDJWdeVRRCZ1N5rnkxWxYKbVTU2H8nR3heY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=NXXx6jCE/nbyQsKuWohG4sQT5LHk05qsPV9yauPpwElDpSlvSo9taUPfiASP5WuD8 +dLvle1LKKd/KnWikCIXaKoCkcAxtsfkB7r1tBLnZNh3BufWZc1lyezdOCHiNahFXe +5MXPevRdV2ew2r+tBxDRh4E4GHFpu5IaulpfFmgfGUMNvo41iA3DPl1fwUsOZkFpH 52KvRr5dhcpdEJAiuRLLEUV1BM1Dwh19FiuvS29TDFi2zPdveZpjCQ6vaOZDudPv7Y MwB7zcEL62j/C9SeQBaugXvSJAOByzSuza6ri+E+gP0kQJvwQo/MlcqM11MoYLI6/H kP2zYluDeHl+Q== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8C46E3146; Wed, 11 Oct 2023 13:17:57 +0200 (CEST) Date: Wed, 11 Oct 2023 13:17:57 +0200 From: Alvaro Herrera To: =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= Cc: "pgsql-generallists.postgresql.org" Subject: Re: Can not drop partition if exist foreign keys Message-ID: <202310111117.cdj4ngpfrppg@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Oct-11, Олег Самойлов wrote: > There are two common practice to drop partition from partitioned > table: just drop or detach-drop. But simple drop don't work if exist > foreign key. Example script attached. Yeah. Detach it first, then you should be able to drop it. > psql:test.sql:15: ERROR: cannot drop table parent_0 because other objects depend on it > DETAIL: constraint children_id_fkey on table children depends on table parent_0 > HINT: Use DROP ... CASCADE to drop the dependent objects too. > > Looked like a bug. We tried to make DROP work, but we didn't find a way. Patches welcome. -- Álvaro Herrera