1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-02 09:26:47 +03:00

Add RENAME support for PUBLICATIONs and SUBSCRIPTIONs

From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
This commit is contained in:
Peter Eisentraut
2017-03-03 10:47:04 -05:00
parent 713f7c47d9
commit 6da9759a03
9 changed files with 90 additions and 8 deletions
src
backend
commands
parser
replication
logical
bin
test

@ -1259,6 +1259,21 @@ reread_subscription(void)
proc_exit(0);
}
/*
* Exit if subscription name was changed (it's used for
* fallback_application_name). The launcher will start new worker.
*/
if (strcmp(newsub->name, MySubscription->name) != 0)
{
ereport(LOG,
(errmsg("logical replication worker for subscription \"%s\" will "
"restart because subscription was renamed",
MySubscription->name)));
walrcv_disconnect(wrconn);
proc_exit(0);
}
/*
* Exit if publication list was changed. The launcher will start
* new worker.
@ -1292,7 +1307,6 @@ reread_subscription(void)
/* Check for other changes that should never happen too. */
if (newsub->dbid != MySubscription->dbid ||
strcmp(newsub->name, MySubscription->name) != 0 ||
strcmp(newsub->slotname, MySubscription->slotname) != 0)
{
elog(ERROR, "subscription %u changed unexpectedly",