Add ALTER ROLE ALL SETtoadd settings to all users (Peter Eisentraut)
此命令支持一个命令设置所有用户(role) 的配置参数,而之前版本不支持这个功能。
ALTER ROLE 命令语法
PostgreSQL 9.2 版本 ALTER ROLE
1 2 3 4
ALTERROLEname [ INDATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAULT } ALTERROLEname [ INDATABASE database_name ] SET configuration_parameter FROMCURRENT ALTERROLEname [ INDATABASE database_name ] RESET configuration_parameter ALTERROLEname [ INDATABASE database_name ] RESET ALL
PostgreSQL 9.3 版本 ALTER ROLE
1 2 3 4
ALTERROLEname [ INDATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAULT } ALTERROLE { name | ALL } [ INDATABASE database_name ] SET configuration_parameter FROMCURRENT ALTERROLE { name | ALL } [ INDATABASE database_name ] RESET configuration_parameter ALTERROLE { name | ALL } [ INDATABASE database_name ] RESET ALL
备注:接下来简单测试下。
ALTER ROLE 命令测试
查看 role 信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[pg93@redhatB ~]$ psql francs postgres psql (9.3beta1) Type "help"for help. francs=# /du List of roles Role name | Attributes | Member of -------------+------------------------------------------------+----------- francs | No inheritance | {} postgres | Superuser, Create role, Create DB, Replication | {} select_only | No inheritance | {} source_db | No inheritance | {} francs=# select * from pg_db_role_setting ; setdatabase | setrole | setconfig -------------+---------+----------- (0 rows)
备注:此时还没有争对 role 级设置参数。
设置所有 role 的 log_min_duration_statement 参数
1 2 3 4 5 6 7 8
francs=# alter role ALL setlog_min_duration_statement=200; ALTER ROLE francs=# select * from pg_db_role_setting ; setdatabase | setrole | setconfig -------------+---------+---------------------------------- 0 | 0 | {log_min_duration_statement=200} (1 row)