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 1u9Nxr-001Cwd-Gk for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 12:52:03 +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 1u9Nxp-000jum-It for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 12:52:02 +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 1u9Nxp-000jue-A6 for pgsql-hackers@lists.postgresql.org; Mon, 28 Apr 2025 12:52:02 +0000 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u9Nxo-0000Ay-0n for pgsql-hackers@lists.postgresql.org; Mon, 28 Apr 2025 12:52:01 +0000 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-7086dcab64bso13322667b3.1 for ; Mon, 28 Apr 2025 05:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745844718; x=1746449518; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7tNY+NvYoVuF1JD6uRhyPD7z8s/VJDZfOv+XtuOn81Y=; b=ZdlbD/np8UiQg97i6tT7bGjHjwEHURXPXfsXP+2IH/d2T+PCsvxcqDTUr8hfYW+Df3 jG1znvwQ0K0i3KASKKSZ/dKKkDDbTDEKHA3pvf7Va4102SOsOLzU5V8VNXxpjiMsVZb6 AzRDVVvmAeElHFhtK8cuolVtA4f3nRqRqVml/Eg65nv3hp0WudjjaEgTmWT0Wa2QpM5b LJaxZcdON17pSoHMq6sjuEcFr35VHR1K3WXlYlVYTjUdYfEARvFs/Sj6LiQ9O2tu31dr wFLPUKwXFG6QOnDrf4ylNcuQR+CZ2StEiNUVqSoaIC8z+C60G7pRAnX3yERtGqefGsqo mRHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745844718; x=1746449518; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7tNY+NvYoVuF1JD6uRhyPD7z8s/VJDZfOv+XtuOn81Y=; b=gxIsKnz8OQsIK41FRvYSNjz1Po9FMhFa7MdkgIwF8qRn/6nqnWCBBNSl86VoDUOXWN L6UY7NpPH3GNJX7uNLTfZphRaRCPugJCJnojrKYcRflVUTEJb4RWI/vzw+80uuUm7gnw 9EOzKE8pMmvK4D2goqcRmY34aHPQPiXsF1tWzE65AlYa9GAP2rPJ9g65yKH5k77Ci39h 2P7DC34DoUAkZkrd9XgKFgutEVUH100InBf+QHdjSHuCncth/i3Gcfb6t4k99+pw67Zx mkVObuy1h9ofevTxekUK7ruVQ08wLRfcO9cQv6HetuUpv9OVs1sY+iPlE8FFGA2zUtZV x9QQ== X-Forwarded-Encrypted: i=1; AJvYcCUNlgmKQEOLXY4PUEwPpw6Y3sQUH52WCzz6saTdTgUXPIGhbUIVH1jAATf9YhQ4YEbw7jALvUTYCLdAOeFK@lists.postgresql.org X-Gm-Message-State: AOJu0YyiLd+SmvxzGlmRFDPUFEG6DUk4qjsL2l26fRsU3goez1AahWmY 8s+Fe4QH2x5/0kbTOFcR/XWt0bnT8K+qIjdNvVWk/qSDFu6iy9xFsIyvGOhiZgFHc8pOS+kIU82 2O8qaNiaaehjnRrXJt17GDdT4gWM= X-Gm-Gg: ASbGncs1Ml+sDvo3YXm4eho7CsgW1Sms41y/sQtmvQvNP/S3DDOmDw1efZ9QAQVaCjI RKHaapOPLHw1r64la5WNdk0ajIGV6HigY9yjNaBy+Cuq2s2ejD24hjjETFMoG8qxCX3TzZg/xXl r8zg+t8IZ4uPZf/7EeAlnwnkza X-Google-Smtp-Source: AGHT+IHQFqzsFSpufG2KiBMJbwZ1/gXXqZa5LhBVC9Wu+RUtCxRQz8EG6tXEBCmdsD6x6e5DXZfopdO7iqwSU0oSZCQ= X-Received: by 2002:a05:690c:6108:b0:6fe:bf9d:5de6 with SMTP id 00721157ae682-70853f85385mr149032737b3.0.1745844718044; Mon, 28 Apr 2025 05:51:58 -0700 (PDT) MIME-Version: 1.0 References: <202504062027.tqmabk2h353o@alvherre.pgsql> In-Reply-To: From: Shlok Kyal Date: Mon, 28 Apr 2025 18:21:46 +0530 X-Gm-Features: ATxdqUHa9tlx-8zuaA06z6Mj-cxSkqDQfjvY4F865R5GHG0iyi9ii0yJlibVbyg Message-ID: Subject: Re: Restrict publishing of partitioned table with a foreign table as partition To: Sergey Tatarintsev Cc: =?UTF-8?Q?=C3=81lvaro_Herrera?= , vignesh C , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 7 Apr 2025 at 09:43, Sergey Tatarintsev wrote: > > 07.04.2025 03:27, =C3=81lvaro Herrera =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On 2025-Apr-01, Shlok Kyal wrote: > > I have modified the comment in create_publication.sgml and also added > comment in the restrictions section of logical-replication.sgml. > I have also added a more detailed explanation in comment of > 'check_foreign_tables' > > I have attached the updated v11 patch. > > Sadly I don't have time to describe the changes proposed here right now, > but I'll do that early tomorrow. (Some minor changes are still needed, > particularly the comments to publication_check_foreign_parts which are > mostly unchanged from what your patch has. I'll do another review round > tomorrow.) > > Hello! > > I looked at the latest patch again and found one more place for list_free= (). Also look at additional test case: > > diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/p= g_publication.c index 51e463c112b..7fcc191feb9 100644 --- a/src/backend/cat= alog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -442,6 = +442,7 @@ GetPubPartitionOptionRelations(List *result, PublicationPartOpt p= ub_partopt, result =3D lappend_oid(result, partOi= d); } + list_free(all_parts); } = else result =3D lappend_oid(result, relid); diff --git a= /src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sq= l index 49c9d98b668..e56aebc397a 100644 --- a/src/test/regress/sql/publicat= ion.sql +++ b/src/test/regress/sql/publication.sql @@ -1296,6 +1296,14 @@ S= ELECT pubname, tablename FROM pg_publication_tables WHERE schemaname in ('s= ch3' -- foreign partition ALTER PUBLICATION pub1 SET (publish_via_partiti= on_root); +CREATE SCHEMA sch5; +CREATE SCHEMA sch6; +CREATE TABLE sch6.tm= ain(id int) PARTITION BY RANGE(id); +CREATE TABLE sch5.part1 PARTITION OF s= ch6.tmain FOR VALUES FROM (0) TO (10) PARTITION BY RANGE(id); +CREATE FOREI= GN TABLE sch6.part2 PARTITION OF sch5.part1 FOR VALUES FROM (0) TO (5) SERV= ER fdw_server; +CREATE PUBLICATION pub4 FOR TABLES IN SCHEMA sch5 WITH (pub= lish_via_partition_root); +SELECT pubname, tablename FROM pg_publication_ta= bles WHERE pubname =3D 'pub4' ORDER BY pubname, tablename; + DROP PUBLICAT= ION pub1; DROP PUBLICATION pub2; DROP PUBLICATION pub3; > > I think this is a wrong assumption: > > ScanKeyInit(&key[keycount++], Anum_pg_class_relispartition, BTEqualStrate= gyNumber, F_BOOLEQ, BoolGetDatum(false)); > > In this case sch5.part1 is partitioned table, but it also partition of ta= ble in different schema > Hi Sergey, Thanks for reviewing the patch. I have addressed the comment in the latest patch shared in [1]. [1]: https://www.postgresql.org/message-id/CANhcyEW0QMiJXMqpPFRHni-q0Rm4R0h= pZ0LdaqA%3DF3wvDUU6sQ%40mail.gmail.com Thanks and Regards, Shlok Kyal