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-07 10:42:17
Message-ID: CA+vB=AFPWUqJPmn6NmmiM9T4KT8nxkRiVJ4p5wETtwSgZVMR7w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro,

Thanks for your input.

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;
};

name_list: name
{ $$ = list_make1(makeString($1)); }
| name_list ',' name
{ $$ = lappend($1, makeString($3)); };

Oh, we also have textarray_to_strvaluelist() which is essentially
> identical, but also static. If we're making one of them non-static,
> then for sure let's remove the other one. But maybe what we really need
> is a third one to use in ruleutils, and expose neither? (I think if we
> get rid of the String around Subscription->publications, that's likely
> what I'd do, since they'd be mostly trivial wrappers around
> deconstruct_array_builtin.)
>

I think we really need a third one to use in ruleutils, and expose neither.
Find the attached v3 patch which does the same.

Attachment Content-Type Size
v3-Add-pg_get_subscription_ddl-function.patch application/octet-stream 26.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-11-07 11:28:27 Re: relfilenode statistics
Previous Message Jakub Wartak 2025-11-07 10:36:05 Re: contrib/pg_stat_tcpinfo