@@ -3400,12 +3400,15 @@ getPublications(Archive *fout)
3400
3400
3401
3401
resetPQExpBuffer(query);
3402
3402
3403
+ /* Make sure we are in proper schema */
3404
+ selectSourceSchema(fout, "pg_catalog");
3405
+
3403
3406
/* Get the publications. */
3404
3407
appendPQExpBuffer(query,
3405
3408
"SELECT p.tableoid, p.oid, p.pubname, "
3406
3409
"(%s p.pubowner) AS rolname, "
3407
3410
"p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
3408
- "FROM pg_catalog. pg_publication p",
3411
+ "FROM pg_publication p",
3409
3412
username_subquery);
3410
3413
3411
3414
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3556,6 +3559,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
3556
3559
3557
3560
query = createPQExpBuffer();
3558
3561
3562
+ /* Make sure we are in proper schema */
3563
+ selectSourceSchema(fout, "pg_catalog");
3564
+
3559
3565
for (i = 0; i < numTables; i++)
3560
3566
{
3561
3567
TableInfo *tbinfo = &tblinfo[i];
@@ -3581,8 +3587,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
3581
3587
/* Get the publication membership for the table. */
3582
3588
appendPQExpBuffer(query,
3583
3589
"SELECT pr.tableoid, pr.oid, p.pubname "
3584
- "FROM pg_catalog.pg_publication_rel pr,"
3585
- " pg_catalog.pg_publication p "
3590
+ "FROM pg_publication_rel pr, pg_publication p "
3586
3591
"WHERE pr.prrelid = '%u'"
3587
3592
" AND p.oid = pr.prpubid",
3588
3593
tbinfo->dobj.catId.oid);
@@ -3708,13 +3713,16 @@ getSubscriptions(Archive *fout)
3708
3713
if (dopt->no_subscriptions || fout->remoteVersion < 100000)
3709
3714
return;
3710
3715
3716
+ /* Make sure we are in proper schema */
3717
+ selectSourceSchema(fout, "pg_catalog");
3718
+
3711
3719
if (!is_superuser(fout))
3712
3720
{
3713
3721
int n;
3714
3722
3715
3723
res = ExecuteSqlQuery(fout,
3716
3724
"SELECT count(*) FROM pg_subscription "
3717
- "WHERE subdbid = (SELECT oid FROM pg_catalog. pg_database"
3725
+ "WHERE subdbid = (SELECT oid FROM pg_database"
3718
3726
" WHERE datname = current_database())",
3719
3727
PGRES_TUPLES_OK);
3720
3728
n = atoi(PQgetvalue(res, 0, 0));
@@ -3734,8 +3742,8 @@ getSubscriptions(Archive *fout)
3734
3742
"(%s s.subowner) AS rolname, "
3735
3743
" s.subconninfo, s.subslotname, s.subsynccommit, "
3736
3744
" s.subpublications "
3737
- "FROM pg_catalog. pg_subscription s "
3738
- "WHERE s.subdbid = (SELECT oid FROM pg_catalog. pg_database"
3745
+ "FROM pg_subscription s "
3746
+ "WHERE s.subdbid = (SELECT oid FROM pg_database"
3739
3747
" WHERE datname = current_database())",
3740
3748
username_subquery);
3741
3749
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6724,7 +6732,7 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables)
6724
6732
"oid, "
6725
6733
"stxname, "
6726
6734
"pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
6727
- "FROM pg_statistic_ext "
6735
+ "FROM pg_catalog. pg_statistic_ext "
6728
6736
"WHERE stxrelid = '%u' "
6729
6737
"ORDER BY stxname", tbinfo->dobj.catId.oid);
6730
6738
0 commit comments