summaryrefslogtreecommitdiff
path: root/src/bin/psql
diff options
context:
space:
mode:
authorAmit Kapila2024-01-30 11:01:09 +0000
committerAmit Kapila2024-01-30 11:19:28 +0000
commit776621a5e4796fa214b6b29a7ca134f6c138572a (patch)
treeba58dcb69a247bc073eca865879e730c5790ce3a /src/bin/psql
parentb527ebc1d37aa82b771dc9c76111bed1bce35a05 (diff)
Add a failover option to subscriptions.
This commit introduces a new subscription option named 'failover', which provides users with the ability to set the failover property of the replication slot on the publisher when creating or altering a subscription. This uses the replication commands introduced by commit 7329240437 to enable the failover option for a logical replication slot. If the failover option is set to true, the associated replication slots (i.e. the main slot and the table sync slots) in the upstream database are enabled to be synchronized to the standbys. Note that the capability to sync the replication slots will be added in subsequent commits. Thanks to Masahiko Sawada for the design inputs. Author: Shveta Malik, Hou Zhijie, Ajin Cherian Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila Discussion: https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com
Diffstat (limited to 'src/bin/psql')
-rw-r--r--src/bin/psql/describe.c8
-rw-r--r--src/bin/psql/tab-complete.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 9cd8783325c..b6a4eb1d565 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -6571,7 +6571,8 @@ describeSubscriptions(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false,
- false, false, false, false, false, false, false, false, false, false};
+ false, false, false, false, false, false, false, false, false, false,
+ false};
if (pset.sversion < 100000)
{
@@ -6635,6 +6636,11 @@ describeSubscriptions(const char *pattern, bool verbose)
gettext_noop("Password required"),
gettext_noop("Run as owner?"));
+ if (pset.sversion >= 170000)
+ appendPQExpBuffer(&buf,
+ ", subfailover AS \"%s\"\n",
+ gettext_noop("Failover"));
+
appendPQExpBuffer(&buf,
", subsynccommit AS \"%s\"\n"
", subconninfo AS \"%s\"\n",
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index ada711d02ff..151a5211ee4 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1943,7 +1943,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH("(", "PUBLICATION");
/* ALTER SUBSCRIPTION <name> SET ( */
else if (HeadMatches("ALTER", "SUBSCRIPTION", MatchAny) && TailMatches("SET", "("))
- COMPLETE_WITH("binary", "disable_on_error", "origin",
+ COMPLETE_WITH("binary", "disable_on_error", "failover", "origin",
"password_required", "run_as_owner", "slot_name",
"streaming", "synchronous_commit");
/* ALTER SUBSCRIPTION <name> SKIP ( */
@@ -3340,7 +3340,7 @@ psql_completion(const char *text, int start, int end)
/* Complete "CREATE SUBSCRIPTION <name> ... WITH ( <opt>" */
else if (HeadMatches("CREATE", "SUBSCRIPTION") && TailMatches("WITH", "("))
COMPLETE_WITH("binary", "connect", "copy_data", "create_slot",
- "disable_on_error", "enabled", "origin",
+ "disable_on_error", "enabled", "failover", "origin",
"password_required", "run_as_owner", "slot_name",
"streaming", "synchronous_commit", "two_phase");