diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_dump.c | 33 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_dump.h | 1 | ||||
| -rw-r--r-- | src/bin/psql/describe.c | 8 |
3 files changed, 32 insertions, 10 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 857c7c2278a..94459b3539a 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4205,6 +4205,7 @@ getSubscriptions(Archive *fout) int i_subslotname; int i_subsynccommit; int i_subpublications; + int i_subbinary; int i, ntups; @@ -4229,18 +4230,26 @@ getSubscriptions(Archive *fout) query = createPQExpBuffer(); - resetPQExpBuffer(query); - /* Get the subscriptions in current database. */ appendPQExpBuffer(query, - "SELECT s.tableoid, s.oid, s.subname," - "(%s s.subowner) AS rolname, " - " s.subconninfo, s.subslotname, s.subsynccommit, " - " s.subpublications " - "FROM pg_subscription s " - "WHERE s.subdbid = (SELECT oid FROM pg_database" - " WHERE datname = current_database())", + "SELECT s.tableoid, s.oid, s.subname,\n" + " (%s s.subowner) AS rolname,\n" + " s.subconninfo, s.subslotname, s.subsynccommit,\n" + " s.subpublications,\n", username_subquery); + + if (fout->remoteVersion >= 140000) + appendPQExpBuffer(query, + " s.subbinary\n"); + else + appendPQExpBuffer(query, + " false AS subbinary\n"); + + appendPQExpBuffer(query, + "FROM pg_subscription s\n" + "WHERE s.subdbid = (SELECT oid FROM pg_database\n" + " WHERE datname = current_database())"); + res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); ntups = PQntuples(res); @@ -4253,6 +4262,7 @@ getSubscriptions(Archive *fout) i_subslotname = PQfnumber(res, "subslotname"); i_subsynccommit = PQfnumber(res, "subsynccommit"); i_subpublications = PQfnumber(res, "subpublications"); + i_subbinary = PQfnumber(res, "subbinary"); subinfo = pg_malloc(ntups * sizeof(SubscriptionInfo)); @@ -4274,6 +4284,8 @@ getSubscriptions(Archive *fout) pg_strdup(PQgetvalue(res, i, i_subsynccommit)); subinfo[i].subpublications = pg_strdup(PQgetvalue(res, i, i_subpublications)); + subinfo[i].subbinary = + pg_strdup(PQgetvalue(res, i, i_subbinary)); if (strlen(subinfo[i].rolname) == 0) pg_log_warning("owner of subscription \"%s\" appears to be invalid", @@ -4342,6 +4354,9 @@ dumpSubscription(Archive *fout, SubscriptionInfo *subinfo) else appendPQExpBufferStr(query, "NONE"); + if (strcmp(subinfo->subbinary, "t") == 0) + appendPQExpBuffer(query, ", binary = true"); + if (strcmp(subinfo->subsynccommit, "off") != 0) appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit)); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 0c2fcfb3a9c..da97b731b15 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -625,6 +625,7 @@ typedef struct _SubscriptionInfo char *rolname; char *subconninfo; char *subslotname; + char *subbinary; char *subsynccommit; char *subpublications; } SubscriptionInfo; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 3b870c3b17e..e197dcdb4d2 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -5963,7 +5963,7 @@ 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}; if (pset.sversion < 100000) { @@ -5989,6 +5989,12 @@ describeSubscriptions(const char *pattern, bool verbose) if (verbose) { + /* Binary mode is only supported in v14 and higher */ + if (pset.sversion >= 140000) + appendPQExpBuffer(&buf, + ", subbinary AS \"%s\"\n", + gettext_noop("Binary")); + appendPQExpBuffer(&buf, ", subsynccommit AS \"%s\"\n" ", subconninfo AS \"%s\"\n", |
