In client support of v10 features, use standard schema handling.
Back-patch to v10. This continues the work of commit 080351466c5a669bf35a323bdec9e296330a5dbb. Discussion: https://postgr.es/m/CAKOSWN=ds66zLw2SqkLTM8wbXFgDbc_OdkmT3dJfPT2mE5kipA@mail.gmail.com
This commit is contained in:
parent
c0e2062d32
commit
51f4d3ed7e
@ -3475,12 +3475,15 @@ getPublications(Archive *fout)
|
|||||||
|
|
||||||
resetPQExpBuffer(query);
|
resetPQExpBuffer(query);
|
||||||
|
|
||||||
|
/* Make sure we are in proper schema */
|
||||||
|
selectSourceSchema(fout, "pg_catalog");
|
||||||
|
|
||||||
/* Get the publications. */
|
/* Get the publications. */
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"SELECT p.tableoid, p.oid, p.pubname, "
|
"SELECT p.tableoid, p.oid, p.pubname, "
|
||||||
"(%s p.pubowner) AS rolname, "
|
"(%s p.pubowner) AS rolname, "
|
||||||
"p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
|
"p.puballtables, p.pubinsert, p.pubupdate, p.pubdelete "
|
||||||
"FROM pg_catalog.pg_publication p",
|
"FROM pg_publication p",
|
||||||
username_subquery);
|
username_subquery);
|
||||||
|
|
||||||
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
|
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
|
||||||
@ -3631,6 +3634,9 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
|
|
||||||
query = createPQExpBuffer();
|
query = createPQExpBuffer();
|
||||||
|
|
||||||
|
/* Make sure we are in proper schema */
|
||||||
|
selectSourceSchema(fout, "pg_catalog");
|
||||||
|
|
||||||
for (i = 0; i < numTables; i++)
|
for (i = 0; i < numTables; i++)
|
||||||
{
|
{
|
||||||
TableInfo *tbinfo = &tblinfo[i];
|
TableInfo *tbinfo = &tblinfo[i];
|
||||||
@ -3656,8 +3662,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
/* Get the publication membership for the table. */
|
/* Get the publication membership for the table. */
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"SELECT pr.tableoid, pr.oid, p.pubname "
|
"SELECT pr.tableoid, pr.oid, p.pubname "
|
||||||
"FROM pg_catalog.pg_publication_rel pr,"
|
"FROM pg_publication_rel pr, pg_publication p "
|
||||||
" pg_catalog.pg_publication p "
|
|
||||||
"WHERE pr.prrelid = '%u'"
|
"WHERE pr.prrelid = '%u'"
|
||||||
" AND p.oid = pr.prpubid",
|
" AND p.oid = pr.prpubid",
|
||||||
tbinfo->dobj.catId.oid);
|
tbinfo->dobj.catId.oid);
|
||||||
@ -3783,13 +3788,16 @@ getSubscriptions(Archive *fout)
|
|||||||
if (dopt->no_subscriptions || fout->remoteVersion < 100000)
|
if (dopt->no_subscriptions || fout->remoteVersion < 100000)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Make sure we are in proper schema */
|
||||||
|
selectSourceSchema(fout, "pg_catalog");
|
||||||
|
|
||||||
if (!is_superuser(fout))
|
if (!is_superuser(fout))
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
res = ExecuteSqlQuery(fout,
|
res = ExecuteSqlQuery(fout,
|
||||||
"SELECT count(*) FROM pg_subscription "
|
"SELECT count(*) FROM pg_subscription "
|
||||||
"WHERE subdbid = (SELECT oid FROM pg_catalog.pg_database"
|
"WHERE subdbid = (SELECT oid FROM pg_database"
|
||||||
" WHERE datname = current_database())",
|
" WHERE datname = current_database())",
|
||||||
PGRES_TUPLES_OK);
|
PGRES_TUPLES_OK);
|
||||||
n = atoi(PQgetvalue(res, 0, 0));
|
n = atoi(PQgetvalue(res, 0, 0));
|
||||||
@ -3809,8 +3817,8 @@ getSubscriptions(Archive *fout)
|
|||||||
"(%s s.subowner) AS rolname, "
|
"(%s s.subowner) AS rolname, "
|
||||||
" s.subconninfo, s.subslotname, s.subsynccommit, "
|
" s.subconninfo, s.subslotname, s.subsynccommit, "
|
||||||
" s.subpublications "
|
" s.subpublications "
|
||||||
"FROM pg_catalog.pg_subscription s "
|
"FROM pg_subscription s "
|
||||||
"WHERE s.subdbid = (SELECT oid FROM pg_catalog.pg_database"
|
"WHERE s.subdbid = (SELECT oid FROM pg_database"
|
||||||
" WHERE datname = current_database())",
|
" WHERE datname = current_database())",
|
||||||
username_subquery);
|
username_subquery);
|
||||||
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
|
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
|
||||||
@ -6830,7 +6838,7 @@ getExtendedStatistics(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
"oid, "
|
"oid, "
|
||||||
"stxname, "
|
"stxname, "
|
||||||
"pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
|
"pg_catalog.pg_get_statisticsobjdef(oid) AS stxdef "
|
||||||
"FROM pg_statistic_ext "
|
"FROM pg_catalog.pg_statistic_ext "
|
||||||
"WHERE stxrelid = '%u' "
|
"WHERE stxrelid = '%u' "
|
||||||
"ORDER BY stxname", tbinfo->dobj.catId.oid);
|
"ORDER BY stxname", tbinfo->dobj.catId.oid);
|
||||||
|
|
||||||
|
@ -5363,7 +5363,7 @@ describeSubscriptions(const char *pattern, bool verbose)
|
|||||||
"FROM pg_catalog.pg_subscription\n"
|
"FROM pg_catalog.pg_subscription\n"
|
||||||
"WHERE subdbid = (SELECT oid\n"
|
"WHERE subdbid = (SELECT oid\n"
|
||||||
" FROM pg_catalog.pg_database\n"
|
" FROM pg_catalog.pg_database\n"
|
||||||
" WHERE datname = current_database())");
|
" WHERE datname = pg_catalog.current_database())");
|
||||||
|
|
||||||
processSQLNamePattern(pset.db, &buf, pattern, true, false,
|
processSQLNamePattern(pset.db, &buf, pattern, true, false,
|
||||||
NULL, "subname", NULL,
|
NULL, "subname", NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user