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 1vyXtW-000CaX-23 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 16:19:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vyXtU-005xSZ-37 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 16:19:17 +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.96) (envelope-from ) id 1vyXtU-005xSR-1m for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2026 16:19:17 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vyXtT-00000000nPs-0GXq for pgsql-hackers@postgresql.org; Fri, 06 Mar 2026 16:19:16 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4837584120eso72602855e9.1 for ; Fri, 06 Mar 2026 08:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772813954; cv=none; d=google.com; s=arc-20240605; b=kmttxLTtlnNCH12md16X90CotN2tvQ/0zZgi9wZN82BRvUm9FnQjqrpqolzOFrIT4L aJXAvtI0TjC6KleP3vf59nJ3so9iFdp7OHmUiYP5O4AyT63TuydsImbtRP+PdAExwEfL /Lr3Hy1QpMWuwiU3rFx21z1mjIj7QYtklZjEUE6fcdjBLugoEeEchhhhM8uyKQKsuLkJ +q0bEUCuwsRNBMJlvYksQUGmS9kfcbq3sEUuQrOffcVJ+VF1i9HxPa8vluZsJOLla0v1 UjdkR/OyUdaeZBaVLzFyTsYZgENqObEsZ4uSbEfA86uraqiWO5ADh4jKBsun4TqEGa11 3wqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=J2CZLk5qMsMddEIcroYM+vZD8RxPNzmsZxomu8tE9bw=; fh=3ZPfC+PQs4SB+VwYoIgQeGu0V5Njp/CO22QTQBS1Um8=; b=LUtloDfSa5fqk85zgxMcgqW+iBwrwm3MpIi8Ctg9g45bEIGnksLkY2iDS1PxVw+HUp 1dM+HPYZGRP6QaVv8MWosCQ/g3xxE5IUyVJDVOwpUCzsujg1qWzSso5FEB0uQ06F9t+H aV/ohu+mM2VfIupm3/GIqsJyRgLmrpHAv8J+PH7u2PmiiyC4HyacE0w7VVNL+v1wQEII SVP1Nl3GEd/52yPp+5nbHZPd6Hm2apYozK6iIO1q6VjvUoay39r1zvhTeat6sEu1lVBo HKG9yWkhLIjuCijIjEy5sg/VYzKOM9Lz7YkqVRbCuWF52t6HLPzVSRhs4elWcvjGZJ0q G1Jw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772813954; x=1773418754; darn=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=J2CZLk5qMsMddEIcroYM+vZD8RxPNzmsZxomu8tE9bw=; b=ArmPOz/GBRID7d11lzPQGCZBm9RU6PCbKDNF+vM/sZYXtvXprmwFoPePjaeKAVUFr7 piQ6tybErQQrOdd+yGGk8t2J92d2xXBgzS61VYiK2EgGhd8kEU1DOZH82JajZ/8gQz4d 8Uzi7WzWZjej51QJCbmT9N4gAqWojmtuGedWW5eAVeUcHoJHbUIQA+rBotNjOmCtdAfn Bfxo9JLpfnyJJxYAPkS0l6liElgdJ/Fyzu+RvAFm9eHOK6R2KJqxToySfPKOG92uwrUX UOsVFVTC8SulF3gP7imExzax8NO7CvXzflQLOKpk3VVdeWbzUpsCnGu9Shbiu1vvzHFl zcrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772813954; x=1773418754; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=J2CZLk5qMsMddEIcroYM+vZD8RxPNzmsZxomu8tE9bw=; b=eete73AWTsuXRW2Zeq/WEQzkosCprUd0xoWsa/dIBRtAjBFbrHl1+FmID4nimBkPXz fARvoXVicywJ3wb+2nJne8qTx4dyOy3iDWDBhcng22TQmhY3L5lnMZNitjiORhMATXsV DwEAopZQJPNOvGpV1BfjmW4hhmAxdTogWa9cj4MxSpmNlNPc3VLA71uW8Bd9OuJMkMy+ ZsgJfYDAogdmIGtz4vnE6RqNFNsT/uK2ZVJHvpqztiKDgdVkBkBk/I2FsqqEhLT82f3U PctkPJWX2tAFr3qH+x5NNyNYvfa/I9J+WDem23DKqTJ7qj3geEmcp57d8tivWq5Zbopr RyqA== X-Forwarded-Encrypted: i=1; AJvYcCUwGKfdPoAeekD7IVGE9d/xwzQEXOQ+7C1fFGMUnUjH4z4/HHMxlLHJvB7sJlVjjFmhpSpwLqKnPg5Ff6rN@postgresql.org X-Gm-Message-State: AOJu0YwjWOiPY1ZK1Efs0MjtExB6U80GIWFl/neIigngZdI1y7dfRih5 SUdM8t5peQyms71sxpGOk88z4zrnzf7WVU1EreYPWv0WmIy/P8tU7ab13Sb9bZfa4UNV0aZVz9E S6FLPa4HrJLgPcP9cpkP8Ev6MSFTXBKI= X-Gm-Gg: ATEYQzxjdEd889N6t4owzdcHIylGcDPbDeT2BlqopJVb7dAhkVIo7YYy4hUyiT62gD+ 7QhwjVcWti+RpPelIt9o7sG4XeXmV2htxVdf5Tg18nBVbtWHxWwuxg1cKUF9ito7w4YpuU7O2Pr BiORpogvoOauTBeZieJbtLYaiOWyjB3qyU0Gkt8H44mWs4TITkf/Z+8zOoWRaGKOjIwiOnGeEw+ z11koPS03buNENaoRpBsV+RXaUWNcuG7dMfYGiO8u09AmTh4Z6s4Gup0luTNKB/wgg1omIbQ5x9 /4sSH+wUaiJSVYAo5y5iUh14WhvZ26jbgSS++VD7wGryMBGm69v1 X-Received: by 2002:a05:600c:81ca:b0:480:1b65:b741 with SMTP id 5b1f17b1804b1-4852694638dmr50718445e9.15.1772813953450; Fri, 06 Mar 2026 08:19:13 -0800 (PST) MIME-Version: 1.0 References: <149ff9264db27cdf724b65709fbbaee4bf316835.camel@j-davis.com> <830a2bc6cbbb2e6e01c6c0d9f31f320822e10603.camel@j-davis.com> <433d0845248e86c0317d9d396926182cfe157340.camel@j-davis.com> <05ae37abb207cd6bf6b126780024692d91402b0b.camel@j-davis.com> <93392ffa941ab0d436e19e0ab5d04d0e42c02d3f.camel@j-davis.com> <26be917cb07b6aa3ef5dd15f6b59d1b375ece6e8.camel@j-davis.com> <55201bd916e748acfc754c8f95880dae8e4e5ed0.camel@j-davis.com> <2a89b14a2b1622bffb8b137ca1f9ab7866f2d2b9.camel@j-davis.com> <61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com> <0910b47040406c1d24ec0150dafb5bae6b910ed7.camel@j-davis.com> <7338f22c4534322a08ab6ce9f879e2e308eb5e5d.camel@j-davis.com> <34fd5885b8245d1014f4426ea22af61229d42e3e.camel@j-davis.com> <7a5df376fffb273430aec9e89f88c31d52dcf295.camel@j-davis.com> <5dfe845221db2e7d38fc7c2a18a4ba5ea29cdfc0.camel@j-davis.com> <60ff024706fe1beab62a89ac07eb6a721856de2e.camel@j-davis.com> <80303af653a3da2a94e32ff91d6538675e921bf0.camel@j-davis.com> In-Reply-To: <80303af653a3da2a94e32ff91d6538675e921bf0.camel@j-davis.com> From: Ashutosh Bapat Date: Fri, 6 Mar 2026 21:49:00 +0530 X-Gm-Features: AaiRm50R_kwKWQxev4-RkBPWX38krY0wAXVbVdOoqUsPcED20u5v_RnqedLhTrs Message-ID: Subject: Re: [19] CREATE SUBSCRIPTION ... SERVER To: Jeff Davis Cc: Amit Kapila , Masahiko Sawada , Shlok Kyal , Bharath Rupireddy , Joe Conway , pgsql-hackers@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 Thu, Mar 5, 2026 at 2:23=E2=80=AFPM Jeff Davis wrote= : > > On Thu, 2026-03-05 at 09:21 +0530, Amit Kapila wrote: > > We revoke view rights on subconninfo from the public. See below [A] > > in > > system_views.sql. Do we want to do the same for subserver or is it > > okay for users to see it? > > I can't think of a reason that the server name should be secret, but > let me know if you think so. > > > I think the following comment and some place > > in docs needs to be updated. > > [A] > > -- All columns of pg_subscription except subconninfo are publicly > > readable. > > REVOKE ALL ON pg_subscription FROM public; > > GRANT SELECT (oid, subdbid, subskiplsn, subname, subowner, > > Good catch! Thank you. > > > 2. We may want to update the following text in pg_dump docs about the > > new way of connecting to hosts. See [B] (When dumping logical > > replication subscriptions, pg_dump will generate CREATE SUBSCRIPTION > > commands that use the connect =3D false option, so that restoring the > > subscription does not make remote connections for creating a > > replication slot or for initial table copy. That way, the dump can be > > restored without requiring network access to the remote servers. It > > is > > then up to the user to reactivate the subscriptions in a suitable > > way. > > If the involved hosts have changed, the connection information might > > have to be changed.) > > > > [B] - https://www.postgresql.org/docs/devel/app-pgdump.html > > > > I think the above comment is still correct -- it would be a bit easier > to deal with servers rather than raw connection strings, but the > comment already says "...might have to be changed" which is just a > reminder to look. > > > Attached a new patch that also addressed the review comments from here: > > https://www.postgresql.org/message-id/CAD21AoCpr8UfmOngKZ92hZ-78cr2H+3Tbs= 9QLveYoWnWBfxrxw@mail.gmail.com > > Additionally, I ran into a problem that's worth highlighting: > > DROP SERVER ... CASCADE was broken, because the subscription is > dependent on it but that's in a global catalog, which is not handled by > doDeletion(). The subscription is conceptually a per-database object, > but it's in a shared catalog with a subdbid field. I solved that > problem by adding a guard to findDependentObjects() to check for the > referenced object belonging to a shared catalog, and if so it just > throws an error (so CASCADE is not supported for servers used in > subscriptions). That's a simple but not a very satisfying solution, so > let me know if you see a problem with that. I shared the awkwardness, but don't have any better ideas. However, it does raise a question as to why do we need an FDW to be database specific or for that matter a SERVER database specific. That might be because it requires an extension which is database specific. Probably we should support extensions which are database agnostic. However that's way beyond the scope of this patch. Other way around why do we need subscriptions to be shared objects? Again probably beyond the scope of this patch. I also see some code duplicated across Create and Alter subscription code paths. Even without this patch the code was duplicated, but with this patch the amount of duplication has increased. Can we deduplicate some of the code? I don't think we need a separate ForeignServerName function. In AlterSubscription() we already have ForeignSever object which has server name in it. Other two callers invoke ForeignServerConnectionString() which in turn fetches ForeignServer object. Those callers instead may fetch ForeignServer object themselves and pass it to ForeignServerConnectionString() and use it in the error message. The patch has changes to pg_dump.c but there is no corresponding test. But I don't think we need a separate test. If the objects created in regress/*.sql tests are not dropped, 002_pg_upgrade.pl would test dump/restore of subscriptions with server. I think we need tests for testing changes in connection when ALTER SUBSCRIPTION ... SERVER is executed and also those for switching between SERVER and CONNECTION. --=20 Best Wishes, Ashutosh Bapat