Fix ALTER SUBSCRIPTION ... SET PUBLICATION documentation

From: japin <japinli(at)hotmail(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix ALTER SUBSCRIPTION ... SET PUBLICATION documentation
Date: 2021-01-26 11:26:24
Message-ID: MEYP282MB1669EC36DFB14C9C4B676FD8B6BC0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

When I read the documentation of ALTER SUBSCRIPTION ... SET PUBLICATION ... WITH (...),
it says "set_publication_option" only support "refresh" in documentation [1].
However, we can also supply the "copy_data" option, and the code is:

case ALTER_SUBSCRIPTION_PUBLICATION:
{
bool copy_data;
bool refresh;

parse_subscription_options(stmt->options,
NULL, /* no "connect" */
NULL, NULL, /* no "enabled" */
NULL, /* no "create_slot" */
NULL, NULL, /* no "slot_name" */
&copy_data,
NULL, /* no "synchronous_commit" */
&refresh,
NULL, NULL, /* no "binary" */
NULL, NULL); /* no "streaming" */
values[Anum_pg_subscription_subpublications - 1] =
publicationListToArray(stmt->publication);
replaces[Anum_pg_subscription_subpublications - 1] = true;

update_tuple = true;

/* Refresh if user asked us to. */
if (refresh)
{
if (!sub->enabled)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("ALTER SUBSCRIPTION with refresh is not allowed for disabled subscriptions"),
errhint("Use ALTER SUBSCRIPTION ... SET PUBLICATION ... WITH (refresh = false).")));

/* Make sure refresh sees the new list of publications. */
sub->publications = stmt->publication;

AlterSubscription_refresh(sub, copy_data);
}

break;
}

Should we fix the documentation or the code? I'd be inclined fix the documentation.

[1] - https://www.postgresql.org/docs/devel/sql-altersubscription.html

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

Attachment Content-Type Size
fix-alter-subscription-set-publication-doc.patch text/x-patch 927 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2021-01-26 11:33:06 Re: WIP: System Versioned Temporal Table
Previous Message Kyotaro Horiguchi 2021-01-26 11:22:21 Re: shared tempfile was not removed on statement_timeout