@@ -4583,16 +4583,17 @@ getSubscriptions(Archive *fout)
4583
4583
inti_oid;
4584
4584
inti_subname;
4585
4585
inti_subowner;
4586
+ inti_subbinary;
4586
4587
inti_substream;
4587
4588
inti_subtwophasestate;
4588
4589
inti_subdisableonerr;
4589
- inti_suborigin;
4590
+ inti_subpasswordrequired;
4591
+ inti_subrunasowner;
4590
4592
inti_subconninfo;
4591
4593
inti_subslotname;
4592
4594
inti_subsynccommit;
4593
4595
inti_subpublications;
4594
- inti_subbinary;
4595
- inti_subpasswordrequired;
4596
+ inti_suborigin;
4596
4597
inti,
4597
4598
ntups;
4598
4599
@@ -4646,12 +4647,14 @@ getSubscriptions(Archive *fout)
4646
4647
4647
4648
if (fout->remoteVersion >= 160000)
4648
4649
appendPQExpBufferStr(query,
4649
- " s.suborigin,\n"
4650
- " s.subpasswordrequired\n");
4650
+ " s.subpasswordrequired,\n"
4651
+ " s.subrunasowner,\n"
4652
+ " s.suborigin\n");
4651
4653
else
4652
4654
appendPQExpBuffer(query,
4653
- " '%s' AS suborigin,\n"
4654
- " 't' AS subpasswordrequired\n",
4655
+ " 't' AS subpasswordrequired,\n"
4656
+ " 't' AS subrunasowner,\n"
4657
+ " '%s' AS suborigin\n",
4655
4658
LOGICALREP_ORIGIN_ANY);
4656
4659
4657
4660
appendPQExpBufferStr(query,
@@ -4671,16 +4674,17 @@ getSubscriptions(Archive *fout)
4671
4674
i_oid = PQfnumber(res, "oid");
4672
4675
i_subname = PQfnumber(res, "subname");
4673
4676
i_subowner = PQfnumber(res, "subowner");
4674
- i_subconninfo = PQfnumber(res, "subconninfo");
4675
- i_subslotname = PQfnumber(res, "subslotname");
4676
- i_subsynccommit = PQfnumber(res, "subsynccommit");
4677
- i_subpublications = PQfnumber(res, "subpublications");
4678
4677
i_subbinary = PQfnumber(res, "subbinary");
4679
4678
i_substream = PQfnumber(res, "substream");
4680
4679
i_subtwophasestate = PQfnumber(res, "subtwophasestate");
4681
4680
i_subdisableonerr = PQfnumber(res, "subdisableonerr");
4682
- i_suborigin = PQfnumber(res, "suborigin");
4683
4681
i_subpasswordrequired = PQfnumber(res, "subpasswordrequired");
4682
+ i_subrunasowner = PQfnumber(res, "subrunasowner");
4683
+ i_subconninfo = PQfnumber(res, "subconninfo");
4684
+ i_subslotname = PQfnumber(res, "subslotname");
4685
+ i_subsynccommit = PQfnumber(res, "subsynccommit");
4686
+ i_subpublications = PQfnumber(res, "subpublications");
4687
+ i_suborigin = PQfnumber(res, "suborigin");
4684
4688
4685
4689
subinfo = pg_malloc(ntups * sizeof(SubscriptionInfo));
4686
4690
@@ -4693,15 +4697,7 @@ getSubscriptions(Archive *fout)
4693
4697
AssignDumpId(&subinfo[i].dobj);
4694
4698
subinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_subname));
4695
4699
subinfo[i].rolname = getRoleName(PQgetvalue(res, i, i_subowner));
4696
- subinfo[i].subconninfo = pg_strdup(PQgetvalue(res, i, i_subconninfo));
4697
- if (PQgetisnull(res, i, i_subslotname))
4698
- subinfo[i].subslotname = NULL;
4699
- else
4700
- subinfo[i].subslotname = pg_strdup(PQgetvalue(res, i, i_subslotname));
4701
- subinfo[i].subsynccommit =
4702
- pg_strdup(PQgetvalue(res, i, i_subsynccommit));
4703
- subinfo[i].subpublications =
4704
- pg_strdup(PQgetvalue(res, i, i_subpublications));
4700
+
4705
4701
subinfo[i].subbinary =
4706
4702
pg_strdup(PQgetvalue(res, i, i_subbinary));
4707
4703
subinfo[i].substream =
@@ -4710,9 +4706,22 @@ getSubscriptions(Archive *fout)
4710
4706
pg_strdup(PQgetvalue(res, i, i_subtwophasestate));
4711
4707
subinfo[i].subdisableonerr =
4712
4708
pg_strdup(PQgetvalue(res, i, i_subdisableonerr));
4713
- subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
4714
4709
subinfo[i].subpasswordrequired =
4715
4710
pg_strdup(PQgetvalue(res, i, i_subpasswordrequired));
4711
+ subinfo[i].subrunasowner =
4712
+ pg_strdup(PQgetvalue(res, i, i_subrunasowner));
4713
+ subinfo[i].subconninfo =
4714
+ pg_strdup(PQgetvalue(res, i, i_subconninfo));
4715
+ if (PQgetisnull(res, i, i_subslotname))
4716
+ subinfo[i].subslotname = NULL;
4717
+ else
4718
+ subinfo[i].subslotname =
4719
+ pg_strdup(PQgetvalue(res, i, i_subslotname));
4720
+ subinfo[i].subsynccommit =
4721
+ pg_strdup(PQgetvalue(res, i, i_subsynccommit));
4722
+ subinfo[i].subpublications =
4723
+ pg_strdup(PQgetvalue(res, i, i_subpublications));
4724
+ subinfo[i].suborigin = pg_strdup(PQgetvalue(res, i, i_suborigin));
4716
4725
4717
4726
/* Decide whether we want to dump it */
4718
4727
selectDumpableObject(&(subinfo[i].dobj), fout);
@@ -4788,14 +4797,17 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo)
4788
4797
if (strcmp(subinfo->subdisableonerr, "t") == 0)
4789
4798
appendPQExpBufferStr(query, ", disable_on_error = true");
4790
4799
4791
- if (pg_strcasecmp(subinfo->suborigin, LOGICALREP_ORIGIN_ANY) != 0)
4792
- appendPQExpBuffer(query, ", origin = %s", subinfo->suborigin);
4800
+ if (strcmp(subinfo->subpasswordrequired, "t") != 0)
4801
+ appendPQExpBuffer(query, ", password_required = false");
4802
+
4803
+ if (strcmp(subinfo->subrunasowner, "t") == 0)
4804
+ appendPQExpBufferStr(query, ", run_as_owner = true");
4793
4805
4794
4806
if (strcmp(subinfo->subsynccommit, "off") != 0)
4795
4807
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
4796
4808
4797
- if (strcmp (subinfo->subpasswordrequired, "t" ) != 0)
4798
- appendPQExpBuffer(query, ",password_required =false" );
4809
+ if (pg_strcasecmp (subinfo->suborigin, LOGICALREP_ORIGIN_ANY ) != 0)
4810
+ appendPQExpBuffer(query, ",origin =%s", subinfo->suborigin );
4799
4811
4800
4812
appendPQExpBufferStr(query, ");\n");
4801
4813