Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f4e1396

Browse files
committed
In client support of v10 features, use standard schema handling.
Back-patch to v10. This continues the work of commit 0803514. Discussion: https://postgr.es/m/CAKOSWN=ds66zLw2SqkLTM8wbXFgDbc_OdkmT3dJfPT2mE5kipA@mail.gmail.com
1 parent 1048afc commit f4e1396

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,12 +3400,15 @@ getPublications(Archive *fout)
34003400

34013401
resetPQExpBuffer(query);
34023402

3403+
/* Make sure we are in proper schema */
3404+
selectSourceSchema(fout, "pg_catalog");
3405+
34033406
/* Get the publications. */
34043407
appendPQExpBuffer(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-
"FROM pg_catalog.pg_publication p",
3411+
"FROM pg_publication p",
34093412
username_subquery);
34103413

34113414
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3556,6 +3559,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
35563559

35573560
query = createPQExpBuffer();
35583561

3562+
/* Make sure we are in proper schema */
3563+
selectSourceSchema(fout, "pg_catalog");
3564+
35593565
for (i = 0; i < numTables; i++)
35603566
{
35613567
TableInfo *tbinfo = &tblinfo[i];
@@ -3581,8 +3587,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
35813587
/* Get the publication membership for the table. */
35823588
appendPQExpBuffer(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)
37083713
if (dopt->no_subscriptions || fout->remoteVersion < 100000)
37093714
return;
37103715

3716+
/* Make sure we are in proper schema */
3717+
selectSourceSchema(fout, "pg_catalog");
3718+
37113719
if (!is_superuser(fout))
37123720
{
37133721
int n;
37143722

37153723
res = ExecuteSqlQuery(fout,
37163724
"SELECT count(*) FROM pg_subscription "
3717-
"WHERE subdbid = (SELECT oid FROM pg_catalog.pg_database"
3725+
"WHERE subdbid = (SELECT oid FROM pg_database"
37183726
" WHERE datname = current_database())",
37193727
PGRES_TUPLES_OK);
37203728
n = 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-
"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"
37393747
" WHERE datname = current_database())",
37403748
username_subquery);
37413749
res = 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+
"FROM pg_catalog.pg_statistic_ext "
67286736
"WHERE stxrelid = '%u' "
67296737
"ORDER BY stxname", tbinfo->dobj.catId.oid);
67306738

src/bin/psql/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5357,7 +5357,7 @@ describeSubscriptions(const char *pattern, bool verbose)
53575357
"FROM pg_catalog.pg_subscription\n"
53585358
"WHERE subdbid = (SELECT oid\n"
53595359
" FROM pg_catalog.pg_database\n"
5360-
" WHERE datname = current_database())");
5360+
" WHERE datname = pg_catalog.current_database())");
53615361

53625362
processSQLNamePattern(pset.db, &buf, pattern, true, false,
53635363
NULL, "subname", NULL,

0 commit comments

Comments
 (0)