Re: [PATCH] Add pg_get_subscription_ddl() function
| От | Vaibhav Dalvi |
|---|---|
| Тема | Re: [PATCH] Add pg_get_subscription_ddl() function |
| Дата | |
| Msg-id | CA+vB=AFPWUqJPmn6NmmiM9T4KT8nxkRiVJ4p5wETtwSgZVMR7w@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: [PATCH] Add pg_get_subscription_ddl() function (Álvaro Herrera <alvherre@kurilemu.de>) |
| Ответы |
Re: [PATCH] Add pg_get_subscription_ddl() function
|
| Список | pgsql-hackers |
Hi Alvaro,
Thanks for your input.
On Thu, Nov 6, 2025 at 9:18 PM Álvaro Herrera <alvherre@kurilemu.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;
};
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)); };
{ $$ = 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.
Вложения
В списке pgsql-hackers по дате отправления: