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 1vnUtv-00807a-0m for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 04:54:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vnUtu-008xIG-0c for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 04:54:02 +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 1vnUtt-008xI7-2R for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 04:54:01 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vnUtr-00000000T6U-2sxm for pgsql-hackers@postgresql.org; Wed, 04 Feb 2026 04:54:00 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-59de2d1fc2cso9570667e87.2 for ; Tue, 03 Feb 2026 20:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770180837; cv=none; d=google.com; s=arc-20240605; b=fbxeCPZqbrT1dmHQ4GhKqh/UzsjHavNkdwic2sBM1a2Qn/vk9azCcT3FgVyzP7wRJL D2mGG9XyhKDAi1Uvn74MLuyi/FoNhI+BpMDktuBhar+xGcAfp/x8VyWU2cTzZyFxQBcu b4c4rjjKXAHf8D7LCCFuZNunS5j50v4+h9vKr5DlwiwXWUokDAfzrJT89ktHrLBEGa/v IVh2R7mxOrs3atir4yORBMej0EHCgl4GeoJDr2rj7kP8FhL3y77tkRUQpKWEtmMsxuTH alBYuXvjU+AMN9ZJM3wp9kCv10aE9lFO5De5Jnu1g9+/uFO7alQoaoR6lyK5Y2L6t+Qm 1BCA== 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=05RrJ/SOHSgNADoH2Z75bdRbi4BPdDOhIdEjojIwEHY=; fh=xCtIGvk64MjeCRE7vSf5SCk2MBI4npANKPaN+Ov6jho=; b=eAkviAeAZkGohe7oeDTBH2mIo4E0uZbgmiptPWrRXoQQunxxDncuisBsnq8PtHGFBf qGkQ/RsRjvkAwWa/K1urfAQ2GtWpfqxquCx1190JydWvXph5PpOCEZD2FUNdUqXNYuOH omRKFH7c6GTbwscz4/h0Y0eriExurpbv7lYSZO0r13ycDNK33RuWs/G74x94yFw79f8a LFyUjryQ0d8QHI4FsY/gqVDAJMMytU1ec0RQsE0GyCj1EeknsGrTUN9e9TKdwwqtGVY+ 8mQBsFLHekVR5rhO5ZIsWzD173jcf3EXxsEOdFA+OdF8Ffvs7FRTaHkwcVqOgho5WPYR Vaag==; 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=1770180837; x=1770785637; 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=05RrJ/SOHSgNADoH2Z75bdRbi4BPdDOhIdEjojIwEHY=; b=MB6YUcxCzo1dN5AcdpSr7Ioo2s46620YGNiTzaDzweL+5X6cjoz+D1EA8COaSimbZA RGWgwcmW1V+uvZxjAzROGQI3+ysioT8QLt9H3tAm9MaX5xiZJN/jHC3n0NvgljPHs1ZK NsvJlDsXW8zbM1t3FmZ3rw5hfgaBsyjgQHmLphFP3tvJISB/RV2ThCuIxxwG73f2TT5w KVfwusE3DFKlbwm3+4jB6leZjtBWQ9N1KHsGwedBTWHbFpiXbi5FaYoPD908MygFtV3V GB06nJDFrsJzUUSVviBJnSJ+bm1i830Yba84Nsl8EqNSVVvhNBW3ZbliFTF02kmByvAy e97g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770180837; x=1770785637; 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=05RrJ/SOHSgNADoH2Z75bdRbi4BPdDOhIdEjojIwEHY=; b=ShZPnNloxl3R48KX7j3nYjPxyaTsGfDHymQQVUX5l4UkweDJK6ArcsaqkdaIaYUp5/ rPP7MkhVU+sbHpOPEyE6/fv8Yfh6oZdbdCgGb7ky4AJ7Lh6VcUhqQpE9kDUI68A1SJRA BsuLg9ByPozWPjppHYgl8rdZ1i8DGEZt1LLlALaI5bKlR8v/CDvzYKwiSSK/SyrtHsxT 96itgbxKpT5scvDw0CWhLadsDXumEHlpMBTs3dCITWGW80EvZsGnZNbebQ3/mEjo6MCc LV/sr5qwGHeLRJM2QSp1xhZg3qsHh+0XMMFr856O5fn3XZqGTYepsiTCXmKk5zn2iSfu XssQ== X-Forwarded-Encrypted: i=1; AJvYcCXsVLXlgLxH+kELYeFi2HD/l3IEXlL0SfZhZeTqWUrOXiNNkE552Rmgie+Z3X2RX2U8QB4dC7xwcca4XszS@postgresql.org X-Gm-Message-State: AOJu0YyHssK01UOr49B2MJmEWO94QIKeghzcsY7ejx0dVPXXrNYDUB/6 DefM/A6eck4lnnL0a8wZJtF0tWJBI1vrytfU0rCLsiTvH/bCWoaxO8Lcs9y6bkNxOPVf97Lx8TZ JtlsQk0tLM88Op8ZfB4D9GUIDmrKnbnc= X-Gm-Gg: AZuq6aK7sbXCwSSRwsVGRoG3K9pw2CNW6oLKhd5RoXiNgwrpawX0gHp1mms3VPQ+22i rq1/vbsuuMcDVPRCgDyj5gwCSXKpnyiz+2XbIC3q0wtBI9yBzw2g7sQgoEBhNi1LKIrO8CdPwW2 kvCouT6AFPV+BeROuyQO6TPYPvFv1c/kLfltfeLPQMrEgnwI78CqN/0L/wOZKLp63LzX1wN9UB2 /IgtvLeRrgFoK36f9ZOqWUhKZfRfOGnqO+1daQnyHWEd1x9stCwSecPOPleNtnZwqnN5TQpnjFg 6H72pHU+GLKGU8IgfNcUg/EhEQ== X-Received: by 2002:a05:6512:b02:b0:59d:e306:c621 with SMTP id 2adb3069b0e04-59e38c4dbaemr640538e87.48.1770180836772; Tue, 03 Feb 2026 20:53:56 -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> In-Reply-To: <5dfe845221db2e7d38fc7c2a18a4ba5ea29cdfc0.camel@j-davis.com> From: Masahiko Sawada Date: Wed, 4 Feb 2026 13:53:20 +0900 X-Gm-Features: AZwV_QhGKMZEnyZhO14esAggHUWHbA6_5afSgvy0A218_TjxcHfKb-QyAUgS8bI Message-ID: Subject: Re: [19] CREATE SUBSCRIPTION ... SERVER To: Jeff Davis Cc: Shlok Kyal , Ashutosh Bapat , 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 Sat, Jan 10, 2026 at 8:55=E2=80=AFPM Jeff Davis wrot= e: > > On Fri, 2025-12-26 at 13:52 -0800, Jeff Davis wrote: > > On Wed, 2025-04-02 at 17:58 +0530, Shlok Kyal wrote: > > > I reviewed the patch and I have a comment: > > > > > > If version is >=3D18, the query will have 'suboriginremotelsn', > > > 'subenabled', 'subfailover' twice. > > > > Thank you. Fixed and rebased. > > Attached new version with significant changes: > > - fixed several issues (including some improper merges in the last > rebase) > - refactored to share code between postgres_fdw_connection() and > connect_pg_server() > - added docs in postgres_fdw > - added tests in core > - bumped postgres_fdw version to 1.3 > I've reviewed the latest patch set. I understand the motivation behind this proposal and find it useful. Here are some comments: @@ -5580,6 +5580,8 @@ fdw_option: | NO HANDLER { $$ =3D makeDefElem("handler", NULL, @1); } | VALIDATOR handler_name { $$ =3D makeDefElem("validator", (Node *) $2, @1); } | NO VALIDATOR { $$ =3D makeDefElem("validator", NULL, @1); } + | CONNECTION handler_name { $$ =3D makeDefElem("connection", (Node *) $2, @1); } + | NO CONNECTION { $$ =3D makeDefElem("connection", NULL, @1); } ; The documentation for ALTER FOREIGN DATA WRAPPER needs to be updated. --- The security section[1] of logical replication chapter would also need to be updated. Currently we have: To create a subscription, the user must have the privileges of the pg_create_subscription role, as well as CREATE privileges on the database. IIUC if the user uses the SERVER clause, they must have the USAGE privilege on the foreign server too. --- We might want to mention in the documentation of CREATE SERVER[2] that a foreign server's name can be used to connect publication in CREATE SUBSCRIPTION as we have a similar description for dblink_connect(): When using the dblink module, a foreign server's name can be used as an argument of the dblink_connect function to indicate the connection parameters. It is necessary to have the USAGE privilege on the foreign server to be able to use it in this way. --- dblink_connect() function can retrieve the connection string from a foreign server specified in the second argument, which is a very similar use case to CREATE SUBSCRIPTION. Should we make dblink use the new function ForeignServerConnectionString() to get the connection string (in get_connect_string())? --- It would be better to enhance psql's \dRs command to show the server name specified in the subscription. Regards, [1] https://www.postgresql.org/docs/devel/logical-replication-security.html [2] https://www.postgresql.org/docs/devel/sql-createserver.html -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com