Re: [19] CREATE SUBSCRIPTION ... SERVER

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [19] CREATE SUBSCRIPTION ... SERVER
Date: 2026-03-07 07:01:35
Message-ID: CAA4eK1LyHvRoNzZPpPQqo7a=5Wov8F-7+KDduy-9ymcRm=Batg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 5, 2026 at 2:23 PM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>
> 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 also can't think of any straight-forward solution for it. I've not
thought in detail but can a new type of dependency be required to
solve this problem? I am not aware if we are doing something similar
in any other CASCADE operation, so even if we want to go with giving
ERROR for this case, it may be better to get somewhat wider acceptance
for the same unless few other people respond here and consider this as
an acceptable solution.

Few other minor comments:
======================
1.
+# Replicate the changes without columns
+$node_publisher->safe_psql('postgres', "CREATE TABLE tab_no_col()");
+$node_publisher->safe_psql('postgres',
+ "INSERT INTO tab_no_col default VALUES");

I don't see a subscriber-side table or verification code to verify the
above test.

2.
+ Oid subserver BKI_LOOKUP_OPT(pg_foreign_server); /* If connection uses
+ * server */
+

Isn't it better to keep this along with other oids in the beginning of
the catalog, say after subowner? It will also avoid padding before
subserver field.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-03-07 07:05:32 Re: [19] CREATE SUBSCRIPTION ... SERVER
Previous Message Corey Huinker 2026-03-07 06:17:39 Re: Add expressions to pg_restore_extended_stats()