@@ -3475,12 +3475,15 @@ getPublications(Archive *fout)
3475
3475
3476
3476
resetPQExpBuffer(query);
3477
3477
3478
+ /* Make sure we are in proper schema */
3479
+ selectSourceSchema(fout, "pg_catalog");
3480
+
3478
3481
/* Get the publications. */
3479
3482
appendPQExpBuffer(query,
3480
3483
"SELECT p.tableoid, p.oid, p.pubname, "
3481
3484
"(%s p.pubowner) AS rolname, "
3482
3485
"p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
3483
- "FROM pg_catalog. pg_publication p",
3486
+ "FROM pg_publication p",
3484
3487
username_subquery);
3485
3488
3486
3489
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3631,6 +3634,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
3631
3634
3632
3635
query = createPQExpBuffer();
3633
3636
3637
+ /* Make sure we are in proper schema */
3638
+ selectSourceSchema(fout, "pg_catalog");
3639
+
3634
3640
for (i = 0; i < numTables; i++)
3635
3641
{
3636
3642
TableInfo *tbinfo = &tblinfo[i];
@@ -3656,8 +3662,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
3656
3662
/* Get the publication membership for the table. */
3657
3663
appendPQExpBuffer(query,
3658
3664
"SELECT pr.tableoid, pr.oid, p.pubname "
3659
- "FROM pg_catalog.pg_publication_rel pr,"
3660
- " pg_catalog.pg_publication p "
3665
+ "FROM pg_publication_rel pr, pg_publication p "
3661
3666
"WHERE pr.prrelid = '%u'"
3662
3667
" AND p.oid = pr.prpubid",
3663
3668
tbinfo->dobj.catId.oid);
@@ -3783,13 +3788,16 @@ getSubscriptions(Archive *fout)
3783
3788
if (dopt->no_subscriptions || fout->remoteVersion < 100000)
3784
3789
return;
3785
3790
3791
+ /* Make sure we are in proper schema */
3792
+ selectSourceSchema(fout, "pg_catalog");
3793
+
3786
3794
if (!is_superuser(fout))
3787
3795
{
3788
3796
int n;
3789
3797
3790
3798
res = ExecuteSqlQuery(fout,
3791
3799
"SELECT count(*) FROM pg_subscription "
3792
- "WHERE subdbid = (SELECT oid FROM pg_catalog. pg_database"
3800
+ "WHERE subdbid = (SELECT oid FROM pg_database"
3793
3801
" WHERE datname = current_database())",
3794
3802
PGRES_TUPLES_OK);
3795
3803
n = atoi(PQgetvalue(res, 0, 0));
@@ -3809,8 +3817,8 @@ getSubscriptions(Archive *fout)
3809
3817
"(%s s.subowner) AS rolname, "
3810
3818
" s.subconninfo, s.subslotname, s.subsynccommit, "
3811
3819
" s.subpublications "
3812
- "FROM pg_catalog. pg_subscription s "
3813
- "WHERE s.subdbid = (SELECT oid FROM pg_catalog. pg_database"
3820
+ "FROM pg_subscription s "
3821
+ "WHERE s.subdbid = (SELECT oid FROM pg_database"
3814
3822
" WHERE datname = current_database())",
3815
3823
username_subquery);
3816
3824
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6830,7 +6838,7 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables)
6830
6838
"oid, "
6831
6839
"stxname, "
6832
6840
"pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
6833
- "FROM pg_statistic_ext "
6841
+ "FROM pg_catalog. pg_statistic_ext "
6834
6842
"WHERE stxrelid = '%u' "
6835
6843
"ORDER BY stxname", tbinfo->dobj.catId.oid);
6836
6844
0 commit comments