@@ -4596,16 +4596,17 @@ getSubscriptions(Archive *fout)
4596
4596
int i_oid;
4597
4597
int i_subname;
4598
4598
int i_subowner;
4599
+ int i_subbinary;
4599
4600
int i_substream;
4600
4601
int i_subtwophasestate;
4601
4602
int i_subdisableonerr;
4602
- int i_suborigin;
4603
+ int i_subpasswordrequired;
4604
+ int i_subrunasowner;
4603
4605
int i_subconninfo;
4604
4606
int i_subslotname;
4605
4607
int i_subsynccommit;
4606
4608
int i_subpublications;
4607
- int i_subbinary;
4608
- int i_subpasswordrequired;
4609
+ int i_suborigin;
4609
4610
int i,
4610
4611
ntups;
4611
4612
@@ -4659,12 +4660,14 @@ getSubscriptions(Archive *fout)
4659
4660
4660
4661
if (fout->remoteVersion >= 160000)
4661
4662
appendPQExpBufferStr(query,
4662
- " s.suborigin,\n"
4663
- " s.subpasswordrequired\n");
4663
+ " s.subpasswordrequired,\n"
4664
+ " s.subrunasowner,\n"
4665
+ " s.suborigin\n");
4664
4666
else
4665
4667
appendPQExpBuffer(query,
4666
- " '%s' AS suborigin,\n"
4667
- " 't' AS subpasswordrequired\n",
4668
+ " 't' AS subpasswordrequired,\n"
4669
+ " 't' AS subrunasowner,\n"
4670
+ " '%s' AS suborigin\n",
4668
4671
LOGICALREP_ORIGIN_ANY);
4669
4672
4670
4673
appendPQExpBufferStr(query,
@@ -4684,16 +4687,17 @@ getSubscriptions(Archive *fout)
4684
4687
i_oid = PQfnumber(res, "oid");
4685
4688
i_subname = PQfnumber(res, "subname");
4686
4689
i_subowner = PQfnumber(res, "subowner");
4687
- i_subconninfo = PQfnumber(res, "subconninfo");
4688
- i_subslotname = PQfnumber(res, "subslotname");
4689
- i_subsynccommit = PQfnumber(res, "subsynccommit");
4690
- i_subpublications = PQfnumber(res, "subpublications");
4691
4690
i_subbinary = PQfnumber(res, "subbinary");
4692
4691
i_substream = PQfnumber(res, "substream");
4693
4692
i_subtwophasestate = PQfnumber(res, "subtwophasestate");
4694
4693
i_subdisableonerr = PQfnumber(res, "subdisableonerr");
4695
- i_suborigin = PQfnumber(res, "suborigin");
4696
4694
i_subpasswordrequired = PQfnumber(res, "subpasswordrequired");
4695
+ i_subrunasowner = PQfnumber(res, "subrunasowner");
4696
+ i_subconninfo = PQfnumber(res, "subconninfo");
4697
+ i_subslotname = PQfnumber(res, "subslotname");
4698
+ i_subsynccommit = PQfnumber(res, "subsynccommit");
4699
+ i_subpublications = PQfnumber(res, "subpublications");
4700
+ i_suborigin = PQfnumber(res, "suborigin");
4697
4701
4698
4702
subinfo = pg_malloc(ntups * sizeof(SubscriptionInfo));
4699
4703
@@ -4706,15 +4710,7 @@ getSubscriptions(Archive *fout)
4706
4710
AssignDumpId(&subinfo[i].dobj);
4707
4711
subinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_subname));
4708
4712
subinfo[i].rolname = getRoleName(PQgetvalue(res, i, i_subowner));
4709
- subinfo[i].subconninfo = pg_strdup(PQgetvalue(res, i, i_subconninfo));
4710
- if (PQgetisnull(res, i, i_subslotname))
4711
- subinfo[i].subslotname = NULL;
4712
- else
4713
- subinfo[i].subslotname = pg_strdup(PQgetvalue(res, i, i_subslotname));
4714
- subinfo[i].subsynccommit =
4715
- pg_strdup(PQgetvalue(res, i, i_subsynccommit));
4716
- subinfo[i].subpublications =
4717
- pg_strdup(PQgetvalue(res, i, i_subpublications));
4713
+
4718
4714
subinfo[i].subbinary =
4719
4715
pg_strdup(PQgetvalue(res, i, i_subbinary));
4720
4716
subinfo[i].substream =
@@ -4723,9 +4719,22 @@ getSubscriptions(Archive *fout)
4723
4719
pg_strdup(PQgetvalue(res, i, i_subtwophasestate));
4724
4720
subinfo[i].subdisableonerr =
4725
4721
pg_strdup(PQgetvalue(res, i, i_subdisableonerr));
4726
- subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
4727
4722
subinfo[i].subpasswordrequired =
4728
4723
pg_strdup(PQgetvalue(res, i, i_subpasswordrequired));
4724
+ subinfo[i].subrunasowner =
4725
+ pg_strdup(PQgetvalue(res, i, i_subrunasowner));
4726
+ subinfo[i].subconninfo =
4727
+ pg_strdup(PQgetvalue(res, i, i_subconninfo));
4728
+ if (PQgetisnull(res, i, i_subslotname))
4729
+ subinfo[i].subslotname = NULL;
4730
+ else
4731
+ subinfo[i].subslotname =
4732
+ pg_strdup(PQgetvalue(res, i, i_subslotname));
4733
+ subinfo[i].subsynccommit =
4734
+ pg_strdup(PQgetvalue(res, i, i_subsynccommit));
4735
+ subinfo[i].subpublications =
4736
+ pg_strdup(PQgetvalue(res, i, i_subpublications));
4737
+ subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
4729
4738
4730
4739
/* Decide whether we want to dump it */
4731
4740
selectDumpableObject(&(subinfo[i].dobj), fout);
@@ -4801,14 +4810,17 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo)
4801
4810
if (strcmp(subinfo->subdisableonerr, "t") == 0)
4802
4811
appendPQExpBufferStr(query, ", disable_on_error = true");
4803
4812
4804
- if (pg_strcasecmp(subinfo->suborigin, LOGICALREP_ORIGIN_ANY) != 0)
4805
- appendPQExpBuffer(query, ", origin = %s", subinfo->suborigin);
4813
+ if (strcmp(subinfo->subpasswordrequired, "t") != 0)
4814
+ appendPQExpBuffer(query, ", password_required = false");
4815
+
4816
+ if (strcmp(subinfo->subrunasowner, "t") == 0)
4817
+ appendPQExpBufferStr(query, ", run_as_owner = true");
4806
4818
4807
4819
if (strcmp(subinfo->subsynccommit, "off") != 0)
4808
4820
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
4809
4821
4810
- if (strcmp (subinfo->subpasswordrequired, "t" ) != 0)
4811
- appendPQExpBuffer(query, ", password_required = false" );
4822
+ if (pg_strcasecmp (subinfo->suborigin, LOGICALREP_ORIGIN_ANY ) != 0)
4823
+ appendPQExpBuffer(query, ", origin = %s", subinfo->suborigin );
4812
4824
4813
4825
appendPQExpBufferStr(query, ");\n");
4814
4826
0 commit comments