Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, yuanchao zhang <145zhangyc(at)gmail(dot)com>
Subject: Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.
Date: 2026-07-31 04:20:06
Message-ID: c7fe6424386631771dd419d17d0c3d952c2e7619.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2026-07-29 at 14:30 -0700, Jeff Davis wrote:
> Proposal:
>
>  * Form a conninfo if and only if a connection is immediately
>    required. That is, it's one of the DDL commands above, or a
>    logical worker.
>
>  * Check USAGE on the server when a connection is formed or when
>    ALTER sets the server or when the subscription owner changes
>    (unless superuser changes the owner, in which case it may be part
>    of a multi-command DDL sequence during restore).
>
>  * Check that the server's FDW supports a connection function when
>    DDL sets the subscription's server.
>
>  * Check that a user mapping exists during DDL when the server or
>    owner changes, but demote the message to a WARNING, because it
>    may be part of a multi-command DDL sequence during restore.
>    - CREATE SUBSCRIPTION already issues WARNINGS during restore.
>
>  * Ensure that none of the commands during restore need a connection.
>    - check_pub_rdt should happen at connection time, and only
>      opportunistically at DDL time if already forming a connection
>
>  * Check walrcv_check_conninfo() before connecting, or during
>    CREATE/ALTER SUBSCRIPTION ... CONNECTION.
>    - If a connection is not needed for DDL, and it's a server-based
>      subscription, walrcv_check_conninfo() will be called only by
>      the logical worker when a connection is needed.
>    - That loses some convenience for interactive DDL, but avoids
>      false positive failures during restore.

Here's a consolidated series of commits.

Fujii, note that this includes a revert of your commit 1c9c358904.
Doing too much validation can cause problems for restore.

Amit, this series does not include the check_pub_rdt change to move it
to the worker.

Shlok Kyal, the change to detect when a refresh is happening is in my
patch 0006, the ACL check fix is in my patch 0007.

Hayato Kuroda, Amit already pushed the --no-subscriptions fix
(02decf9a9a). I didn't change the dump/restore order in this series,
because reducing the errors seems right for v19. We can reconsider it
for v20.

Regards,
Jeff Davis

Attachment Content-Type Size
v3-0001-Fix-lock-release-for-role-membership-grants-in-DR.patch text/x-patch 3.5 KB
v3-0002-Improve-DROP-SERVER-handling-of-dependent-subscri.patch text/x-patch 5.5 KB
v3-0003-postgres_fdw-reject-use_scram_passthrough-for-sub.patch text/x-patch 3.5 KB
v3-0004-Remove-Subscription-conninfo-field-generate-in-ca.patch text/x-patch 16.4 KB
v3-0005-Build-subscription-conninfo-after-checking-that-i.patch text/x-patch 2.5 KB
v3-0006-Be-precise-about-when-ALTER-SUBSCRIPTION-needs-co.patch text/x-patch 6.4 KB
v3-0007-Always-check-foreign-server-USAGE-when-resolving-.patch text/x-patch 6.3 KB
v3-0008-For-subscription-DDL-demote-user-mapping-checks-t.patch text/x-patch 6.4 KB
v3-0009-CREATE-SUBSCRIPTION-do-not-construct-conninfo-unn.patch text/x-patch 5.2 KB
v3-0010-Revert-Validate-subscription-conninfo-on-owner-ch.patch text/x-patch 8.8 KB
v3-0011-When-changing-owner-of-a-subscription-do-not-thro.patch text/x-patch 4.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-07-31 04:30:00 Re: [Patch] Omit virtual generated columns from test_decoding output
Previous Message Tom Lane 2026-07-31 04:00:51 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation