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>
Subject: Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.
Date: 2026-07-19 22:32:49
Message-ID: 35e50b0f80c850e5b9eb1dedcc0844852a2d2de0.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2026-07-10 at 12:59 -0700, Noah Misch wrote:
> An Opus 4.8 review of commit 8185bb5 found two pg_dump+restore
> failure
> scenarios, visible in the attached test patch.  (The patch also tests
> a
> REASSIGN OWNED finding, for which I started a distinct thread
> postgr.es/m/flat/20260710192533(dot)4f(dot)noahmisch(at)microsoft(dot)com).
>
> Opus also emitted the attached report about these findings and
> others.  I
> didn't examine the others closely.  Finding-19, about invalidation
> callbacks,
> stood out as perhaps most exciting if true.

Patch attached.

Generating and validating the connection requires the subscription
owner to be set correctly, the foreign server ACLs to be set, and the
user mapping to exist. The checks at DDL time are were a convenient way
to catch errors, but end up being too strict because those things can
change before the connection is actually needed. In particular, pg_dump
does the DDL in parts (first creating the subscription, then changing
the owner), and we need the first part to succeed.

It would be nice to expand the pg_dump tests to cover this, but that
would require a test dependency on postgres_fdw (or some kind of built-
in test FDW), and I don't think we want that. So I just included SQL
tests.

I think there's a remaining bug involving retaindeadtuples
(228c3708685) where it still tries to connect during binary upgrade. 

That can be seen if you add a $publisher->stop to line 317 (right
before the pg_upgrade that's supposed to succeed) in
004_subscription.pl.

Regards,
Jeff Davis

Attachment Content-Type Size
v1-0001-Fix-dump-restore-of-server-based-subscriptions.patch text/x-patch 12.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-07-19 22:32:53 Re: pg_plan_advice: fix parsing underscore in numbers
Previous Message Tom Lane 2026-07-19 18:30:40 Re: Deprecation warnings on Rocky 10.2 with current dev branch