postgres=# alter role francs in database francs setclient_min_messages='warning'; ALTER ROLE postgres=# select * From pg_db_role_setting where setrole=24920; setdatabase | setrole | setconfig -------------+---------+---------------------------------------------- 0 | 24920 | {log_statement=all,maintenance_work_mem=1GB} 24922 | 24920 | {client_min_messages=warning}
备注:此时 setdatabase 值为 24922, 结果很明显了,不多解释。
2.4 再次查询 pg_user
1 2 3 4 5 6 7 8 9 10 11
postgres=# select * From pg_user where usename='francs'; -[ RECORD 1 ]--------------------------------------------- usename | francs usesysid | 24920 usecreatedb | f usesuper | f usecatupd | f userepl | f passwd | valuntil | useconfig | {log_statement=all,maintenance_work_mem=1GB}
[pg92@redhatB ~]$ psql psql (9.2.1) Type "help"for help. postgres=# show log_statement; log_statement --------------- none (1 row) postgres=# /c francs francs You are now connected to database "francs" as user "francs". francs=> show log_statement; log_statement --------------- all (1 row)
备注:这种方法最直接,但很不方便。
取消用户级参数设置
4.1 取消对用户 francs 的 maintenance_work_mem 设置
1 2
postgres=# alter role francs reset maintenance_work_mem; ALTER ROLE
4.2 验证
1 2 3 4 5 6 7 8 9 10 11
postgres=# select * From pg_user where usename='francs'; -[ RECORD 1 ]-------------------- usename | francs usesysid | 24920 usecreatedb | f usesuper | f usecatupd | f userepl | f passwd | valuntil | useconfig | {log_statement=all}
备注:如果想取消多个参数,则使用”RESET ALL” 语法。
4.3 RESET ALL 语法
1
ALTERROLEname [ INDATABASE database_name ] RESET ALL