@@ -3400,12 +3400,15 @@ getPublications(Archive *fout)
34003400
34013401resetPQExpBuffer(query);
34023402
3403+ /* Make sure we are in proper schema */
3404+ selectSourceSchema(fout, "pg_catalog");
3405+
34033406/* Get the publications. */
34043407appendPQExpBuffer(query,
34053408 "SELECT p.tableoid, p.oid, p.pubname, "
34063409 "(%s p.pubowner) AS rolname, "
34073410 "p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
3408- "FROMpg_catalog. pg_publication p",
3411+ "FROM pg_publication p",
34093412 username_subquery);
34103413
34113414res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3556,6 +3559,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
35563559
35573560query = createPQExpBuffer();
35583561
3562+ /* Make sure we are in proper schema */
3563+ selectSourceSchema(fout, "pg_catalog");
3564+
35593565for (i = 0; i < numTables; i++)
35603566{
35613567TableInfo *tbinfo = &tblinfo[i];
@@ -3581,8 +3587,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
35813587/* Get the publication membership for the table. */
35823588appendPQExpBuffer(query,
35833589 "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 "
35863591 "WHERE pr.prrelid = '%u'"
35873592 " AND p.oid = pr.prpubid",
35883593 tbinfo->dobj.catId.oid);
@@ -3708,13 +3713,16 @@ getSubscriptions(Archive *fout)
37083713if (dopt->no_subscriptions || fout->remoteVersion < 100000)
37093714return;
37103715
3716+ /* Make sure we are in proper schema */
3717+ selectSourceSchema(fout, "pg_catalog");
3718+
37113719if (!is_superuser(fout))
37123720{
37133721intn;
37143722
37153723res = ExecuteSqlQuery(fout,
37163724 "SELECT count(*) FROM pg_subscription "
3717- "WHERE subdbid = (SELECT oid FROMpg_catalog. pg_database"
3725+ "WHERE subdbid = (SELECT oid FROM pg_database"
37183726 " WHERE datname = current_database())",
37193727 PGRES_TUPLES_OK);
37203728n = atoi(PQgetvalue(res, 0, 0));
@@ -3734,8 +3742,8 @@ getSubscriptions(Archive *fout)
37343742 "(%s s.subowner) AS rolname, "
37353743 " s.subconninfo, s.subslotname, s.subsynccommit, "
37363744 " s.subpublications "
3737- "FROMpg_catalog. pg_subscription s "
3738- "WHERE s.subdbid = (SELECT oid FROMpg_catalog. pg_database"
3745+ "FROM pg_subscription s "
3746+ "WHERE s.subdbid = (SELECT oid FROM pg_database"
37393747 " WHERE datname = current_database())",
37403748 username_subquery);
37413749res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6724,7 +6732,7 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables)
67246732 "oid, "
67256733 "stxname, "
67266734 "pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
6727- "FROM pg_statistic_ext "
6735+ "FROMpg_catalog. pg_statistic_ext "
67286736 "WHERE stxrelid = '%u' "
67296737 "ORDER BY stxname", tbinfo->dobj.catId.oid);
67306738