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 1twk1c-00HAME-OI for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Mar 2025 15:47:40 +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 1twk1b-005I1D-GW for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Mar 2025 15:47:39 +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 1twk1b-005HzS-4q for pgsql-hackers@lists.postgresql.org; Mon, 24 Mar 2025 15:47:39 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1twk1Y-000tp7-1U for pgsql-hackers@lists.postgresql.org; Mon, 24 Mar 2025 15:47:38 +0000 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id EC0282540147; Mon, 24 Mar 2025 11:47:34 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Mon, 24 Mar 2025 11:47:35 -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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1742831254; x=1742917654; bh=q TH5jYiHCQQ6dXdd4tIo4zjH+c/Xo+CTtlLgS3EFZHc=; b=m6BIoK46urjWGh1/4 5uEt3fM/OxwaPWI9mGYc2PLrFStMcp7fH6xDIAcXqBnqSLS+3l1lX654C7NGdZlI u1Hi4PuUGMQjCPQKfMa6UGaGC8VyhUvj+rcvJpHKWT1e/zfws17IXVvlW9KU9bBZ 4+vZwHRxoMQl/BMQI+9doTPe1K4nBqOAgtHjjuEDldN5wXwzvjyuB/bD6wJ6kNLR Cn+H8kJXS6ytpTyZtz6xYZdDEfK5AqKAKULd6zhyfkyh7HWeEtV2TjQePGMysX9a A1SkecQXvm56qAhUmLI1DRe7Q9pGgHqkVLOx6Y6I+3mCutVNnguqLcmoE24sYYBl kQezg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduiedtudejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddt jeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdehueffhefgueekueef heehgffhuefgfedukeejveduffegffekgeffffevgeehnecuffhomhgrihhnpegvnhhtvg hrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsg gprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehshhhlohhk rdhkhigrlhdrohhsshesghhmrghilhdrtghomhdprhgtphhtthhopehvihhgnhgvshhhvd dusehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhi shhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepshdrthgrthgrrhhinh htshgvvhesphhoshhtghhrvghsphhrohdrrhhu X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Mar 2025 11:47:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1742831251; bh=OifSHDMU7DrBzMsX5z0EU6hi7dIof5sgy7byeIvekhU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=MjcEf14o4OadWQ4d/MKKC0NQI1+pDjTev3whU07AGJVD/X6FWkx+Xhs8BMLX0/CGz lf74fjrrEFVtzysUpyP0PmfD+hvPBP6hSwgiIDa6fToBc7oVIu5cjf0+qkDFeVweVV QhCoCGa9xJjsikI65EASo6s1ys53K485dRL1FDYvGYOAttKhgQ123VT7dJ+sH6D1I1 j0Ksb8BJIxnqE40LqLWTPG5WpMceA3FASQLAgWdlWtqfecJuvjGdytHUeQ4mnLym1P 61VPu+mgruXbeL5hci8PxzLuSCo/WV97v4EMgS2IGtj4qrJpcgRzm2ks2enibadk9r oe8udiUvwWaCQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 80C976E; Mon, 24 Mar 2025 16:47:31 +0100 (CET) Date: Mon, 24 Mar 2025 16:47:31 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Shlok Kyal Cc: vignesh C , Sergey Tatarintsev , pgsql-hackers@lists.postgresql.org Subject: Re: Restrict publishing of partitioned table with a foreign table as partition Message-ID: <202503241547.a2moisgqvj73@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 One thing that bothers me a bit about this is that there's no single code comment where this restriction it documented in full; in fact it doesn't seem documented anywhere, only in the commit message. I think check_foreign_tables() is a good place to add an explanatory comment; other places can reference that. For instance, add something like /* * Protect against including foreign tables that are partitions of * partitioned tables published by the given publication. This would * not work properly, because , so we disallow * the case here and in all DDL commands that would end up creating * such a case indirectly. */ Then for instance in check_publication_add_relation() and ATExecAttachPartition() you comment would say /* if the would-be partition is a foreign table, verify that the partitioned table is not in a publication with publish_via_root=false. See check_foreign_tables for details */ Also, surely we should document this restriction in the SGML docs somewhere. Would it be better if check_partrel_has_foreign_table() used RelationGetPartitionDesc(omit_detached=true) instead of find_all_inheritors()? I'm wary of all those accesses of subscription/publication catalogs in DDL code. Maybe I worry about nothing, but I cannot but feel that we're missing one layer of abstraction there (including possibly some caching on top of syscache). I think this castNode(RangeVar, lfirst(list_head(stmt->base.inhRelations))); is better written linitial_node(RangeVar, stmt->base.inhRelations); -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Tiene valor aquel que admite que es un cobarde" (Fernandel)