@@ -3475,12 +3475,15 @@ getPublications(Archive *fout)
34753475
34763476 resetPQExpBuffer(query);
34773477
3478+ /* Make sure we are in proper schema */
3479+ selectSourceSchema(fout, "pg_catalog");
3480+
34783481 /* Get the publications. */
34793482 appendPQExpBuffer(query,
34803483 "SELECT p.tableoid, p.oid, p.pubname, "
34813484 "(%s p.pubowner) AS rolname, "
34823485 "p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
3483- "FROM pg_catalog. pg_publication p",
3486+ "FROM pg_publication p",
34843487 username_subquery);
34853488
34863489 res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3631,6 +3634,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
36313634
36323635 query = createPQExpBuffer();
36333636
3637+ /* Make sure we are in proper schema */
3638+ selectSourceSchema(fout, "pg_catalog");
3639+
36343640 for (i = 0; i < numTables; i++)
36353641 {
36363642 TableInfo *tbinfo = &tblinfo[i];
@@ -3656,8 +3662,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
36563662 /* Get the publication membership for the table. */
36573663 appendPQExpBuffer(query,
36583664 "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 "
36613666 "WHERE pr.prrelid = '%u'"
36623667 " AND p.oid = pr.prpubid",
36633668 tbinfo->dobj.catId.oid);
@@ -3783,13 +3788,16 @@ getSubscriptions(Archive *fout)
37833788 if (dopt->no_subscriptions || fout->remoteVersion < 100000)
37843789 return;
37853790
3791+ /* Make sure we are in proper schema */
3792+ selectSourceSchema(fout, "pg_catalog");
3793+
37863794 if (!is_superuser(fout))
37873795 {
37883796 int n;
37893797
37903798 res = ExecuteSqlQuery(fout,
37913799 "SELECT count(*) FROM pg_subscription "
3792- "WHERE subdbid = (SELECT oid FROM pg_catalog. pg_database"
3800+ "WHERE subdbid = (SELECT oid FROM pg_database"
37933801 " WHERE datname = current_database())",
37943802 PGRES_TUPLES_OK);
37953803 n = atoi(PQgetvalue(res, 0, 0));
@@ -3809,8 +3817,8 @@ getSubscriptions(Archive *fout)
38093817 "(%s s.subowner) AS rolname, "
38103818 " s.subconninfo, s.subslotname, s.subsynccommit, "
38113819 " 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"
38143822 " WHERE datname = current_database())",
38153823 username_subquery);
38163824 res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6830,7 +6838,7 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables)
68306838 "oid, "
68316839 "stxname, "
68326840 "pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
6833- "FROM pg_statistic_ext "
6841+ "FROM pg_catalog. pg_statistic_ext "
68346842 "WHERE stxrelid = '%u' "
68356843 "ORDER BY stxname", tbinfo->dobj.catId.oid);
68366844
0 commit comments