1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

Qualify table usage in dumpTable() and use regclass

All of the other tables used in the query in dumpTable(), which is
collecting column-level ACLs, are qualified, so we should be qualifying
the pg_init_privs, the related sub-select against pg_class and the
other queries added by the pg_dump catalog ACLs work.

Also, use ::regclass (or ::pg_catalog.regclass, where appropriate)
instead of using a poorly constructed query to get the OID for various
catalog tables.

Issues identified by Noah and Alvaro, patch by me.
This commit is contained in:
Stephen Frost
2016-05-24 20:10:16 -04:00
parent 2d2e40e3be
commit 2e8b4bf804
3 changed files with 50 additions and 49 deletions

View File

@ -715,20 +715,20 @@ buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery,
* these are run the initial privileges will be in place, even in a
* binary upgrade situation (see below).
*/
printfPQExpBuffer(acl_subquery, "(SELECT array_agg(acl) FROM "
"(SELECT unnest(coalesce(%s,acldefault(%s,%s))) AS acl "
printfPQExpBuffer(acl_subquery, "(SELECT pg_catalog.array_agg(acl) FROM "
"(SELECT pg_catalog.unnest(coalesce(%s,pg_catalog.acldefault(%s,%s))) AS acl "
"EXCEPT "
"SELECT unnest(coalesce(pip.initprivs,acldefault(%s,%s)))) as foo)",
"SELECT pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault(%s,%s)))) as foo)",
acl_column,
obj_kind,
acl_owner,
obj_kind,
acl_owner);
printfPQExpBuffer(racl_subquery, "(SELECT array_agg(acl) FROM "
"(SELECT unnest(coalesce(pip.initprivs,acldefault(%s,%s))) AS acl "
printfPQExpBuffer(racl_subquery, "(SELECT pg_catalog.array_agg(acl) FROM "
"(SELECT pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault(%s,%s))) AS acl "
"EXCEPT "
"SELECT unnest(coalesce(%s,acldefault(%s,%s)))) as foo)",
"SELECT pg_catalog.unnest(coalesce(%s,pg_catalog.acldefault(%s,%s)))) as foo)",
obj_kind,
acl_owner,
acl_column,
@ -753,19 +753,19 @@ buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery,
{
printfPQExpBuffer(init_acl_subquery,
"CASE WHEN privtype = 'e' THEN "
"(SELECT array_agg(acl) FROM "
"(SELECT unnest(pip.initprivs) AS acl "
"(SELECT pg_catalog.array_agg(acl) FROM "
"(SELECT pg_catalog.unnest(pip.initprivs) AS acl "
"EXCEPT "
"SELECT unnest(acldefault(%s,%s))) as foo) END",
"SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s))) as foo) END",
obj_kind,
acl_owner);
printfPQExpBuffer(init_racl_subquery,
"CASE WHEN privtype = 'e' THEN "
"(SELECT array_agg(acl) FROM "
"(SELECT unnest(acldefault(%s,%s)) AS acl "
"(SELECT pg_catalog.array_agg(acl) FROM "
"(SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s)) AS acl "
"EXCEPT "
"SELECT unnest(pip.initprivs)) as foo) END",
"SELECT pg_catalog.unnest(pip.initprivs)) as foo) END",
obj_kind,
acl_owner);
}