Re: [PATCH] Add pg_get_subscription_ddl() function

From: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>
To: alvherre(at)kurilemu(dot)de
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_subscription_ddl() function
Date: 2025-11-11 05:48:32
Message-ID: CA+vB=AGAxwPMPpppk46bRm0T+3CrLPKWkehMVtfSYMef+Rndnw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro,

Thanks for the explanation.

I tried to get rid of String usage in 0001 patch.
Prepared 0002 patch for actual implementation of the
function p_get_subscription_ddl().

Please find attached patches.

Regards,
Vaibhav

On Fri, Nov 7, 2025 at 5:41 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:

> On 2025-Nov-07, Vaibhav Dalvi wrote:
>
> > On Thu, Nov 6, 2025 at 9:18 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de>
> wrote:
> >
> > > Hello Vaibhav,
> > >
> > > I wonder why is Subscription->publications a list of String rather than
> > > a list of C strings. That's something you'd see in a Node structure,
> > > but Subscription is not a node, so this seems wasteful and pointless.
> > >
> >
> > I looked more into this and came to know that we can't make
> > Subscription->publications a list of C strings because input publications
> > list is also in the list of String from the parser:
> >
> > CreateSubscriptionStmt:
> > CREATE SUBSCRIPTION name CONNECTION Sconst PUBLICATION name_list
> > opt_definition
> > {
> > CreateSubscriptionStmt *n =
> > makeNode(CreateSubscriptionStmt);
> > n->subname = $3;
> > n->conninfo = $5;
> > n->publication = $7;
> > n->options = $8;
> > $$ = (Node *) n;
> > };
>
> But this is a CreateSubscriptionStmt (which is indeed a Node), not a
> Subscription (which isn't). Different thing.
>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> "In fact, the basic problem with Perl 5's subroutines is that they're not
> crufty enough, so the cruft leaks out into user-defined code instead, by
> the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6)
>

Attachment Content-Type Size
v4-0001-Use-list-of-C-strings-for-publications.patch application/octet-stream 5.1 KB
v4-0002-Add-pg_get_subscription_ddl-function.patch application/octet-stream 30.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-11-11 05:52:21 Re: Logical Replication of sequences
Previous Message vignesh C 2025-11-11 05:46:18 Re: Logical Replication of sequences