Make pg_dumpall's database ACL query independent of hash table order.

Previously GRANT order on databases was not well defined, due to the use
of EXCEPT without an ORDER BY.  Add an ORDER BY, adapt test output.

I don't, at the moment, see reason to backpatch this.
This commit is contained in:
Andres Freund 2016-10-12 18:29:57 -07:00
parent 248776ea06
commit b4fc645787
2 changed files with 7 additions and 4 deletions

View File

@ -1307,11 +1307,13 @@ dumpCreateDB(PGconn *conn)
"pg_encoding_to_char(d.encoding), "
"datcollate, datctype, datfrozenxid, datminmxid, "
"datistemplate, "
"(SELECT pg_catalog.array_agg(acl) FROM (SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba))) AS acl "
"EXCEPT SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba))) as foo)"
"(SELECT pg_catalog.array_agg(acl ORDER BY acl::text) FROM ( "
" SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba))) AS acl "
" EXCEPT SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba))) as datacls)"
"AS datacl, "
"(SELECT pg_catalog.array_agg(acl) FROM (SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba)) AS acl "
"EXCEPT SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba)))) as foo)"
"(SELECT pg_catalog.array_agg(acl ORDER BY acl::text) FROM ( "
" SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba)) AS acl "
" EXCEPT SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba)))) as rdatacls)"
"AS rdatacl, "
"datconnlimit, "
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "

View File

@ -2484,6 +2484,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
create_sql => 'REVOKE CONNECT ON DATABASE dump_test FROM public;',
regexp => qr/^
\QREVOKE CONNECT,TEMPORARY ON DATABASE dump_test FROM PUBLIC;\E\n
\QGRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;\E\n
\QGRANT TEMPORARY ON DATABASE dump_test TO PUBLIC;\E
/xm,
like => { pg_dumpall_dbprivs => 1, },