提交 dd1ee895 编写于 作者: J Jacob Champion

pg_dumpall: improve DB role setting order

Follow-up to 6beb8eb3. In addition to ordering by the role and database,
order the settings themselves to minimize spurious diffs.

As an example, a role with both search_path and statement_mem set could
be dumped in two ways:

    ALTER ROLE role_setting_test_2 IN DATABASE regression SET search_path TO common_schema;
    ALTER ROLE role_setting_test_2 IN DATABASE regression SET statement_mem TO '150MB';
or
    ALTER ROLE role_setting_test_2 IN DATABASE regression SET statement_mem TO '150MB';
    ALTER ROLE role_setting_test_2 IN DATABASE regression SET search_path TO common_schema;

Now they are dumped in alphabetical order.
上级 955eecb2
......@@ -1904,7 +1904,7 @@ dumpDbRoleConfig(PGconn *conn)
/* Need "ORDER BY" here to keep order consistency cross pg_dump call */
printfPQExpBuffer(buf, "SELECT rolname, datname, unnest(setconfig) "
"FROM pg_db_role_setting, pg_authid, pg_database "
"WHERE setrole = pg_authid.oid AND setdatabase = pg_database.oid ORDER BY 1,2");
"WHERE setrole = pg_authid.oid AND setdatabase = pg_database.oid ORDER BY 1,2,3");
res = executeQuery(conn, buf->data);
if (PQntuples(res) > 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册