diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 1fb19f5..9f2cac9 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4739,7 +4739,7 @@ getSubscriptions(Archive *fout) int i_suboriginremotelsn; int i_subenabled; int i_subfailover; - int i_subincludegencols; + int i_subincludegencols; int i, ntups; @@ -4770,6 +4770,7 @@ getSubscriptions(Archive *fout) " s.subowner,\n" " s.subconninfo, s.subslotname, s.subsynccommit,\n" " s.subpublications,\n"); + if (fout->remoteVersion >= 140000) appendPQExpBufferStr(query, " s.subbinary,\n"); else @@ -4804,7 +4805,7 @@ getSubscriptions(Archive *fout) if (dopt->binary_upgrade && fout->remoteVersion >= 170000) appendPQExpBufferStr(query, " o.remote_lsn AS suboriginremotelsn,\n" - " s.subenabled,\n"); + " s.subenabled,\n"); else appendPQExpBufferStr(query, " NULL AS suboriginremotelsn,\n" " false AS subenabled,\n"); @@ -4815,12 +4816,14 @@ getSubscriptions(Archive *fout) else appendPQExpBuffer(query, " false AS subfailover,\n"); + if (fout->remoteVersion >= 170000) appendPQExpBufferStr(query, " s.subincludegencols\n"); else appendPQExpBufferStr(query, " false AS subincludegencols,\n"); + appendPQExpBufferStr(query, "FROM pg_subscription s\n"); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index a2c35fe..8c07933 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -672,7 +672,6 @@ typedef struct _SubscriptionInfo char *suboriginremotelsn; char *subfailover; char *subincludegencols; - } SubscriptionInfo; /* diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 491fcb9..00f3131 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -6604,7 +6604,7 @@ describeSubscriptions(const char *pattern, bool verbose) gettext_noop("Synchronous commit"), gettext_noop("Conninfo")); - /* include_generated_columns is only supported in v18 and higher */ + /* include_generated_columns is only supported in v18 and higher */ if (pset.sversion >= 170000) appendPQExpBuffer(&buf, ", subincludegencols AS \"%s\"\n", diff --git a/src/test/subscription/t/011_generated.pl b/src/test/subscription/t/011_generated.pl index e612970..6c8d6ce 100644 --- a/src/test/subscription/t/011_generated.pl +++ b/src/test/subscription/t/011_generated.pl @@ -106,7 +106,7 @@ $node_publisher->safe_psql('postgres', "INSERT INTO tab2 VALUES (4), (5)"); $node_publisher->wait_for_catchup('sub2'); -# the column was NOT replicated because the result value of 'b'is the subscriber-side computed value +# the column was NOT replicated (the result value of 'b' is the subscriber-side computed value) $result = $node_subscriber->safe_psql('postgres', "SELECT a, b FROM tab2 ORDER BY a"); is( $result, qq(4|8 5|10), 'confirm generated columns ARE replicated when the subscriber-side column is not generated');