用户级别配置参数
ALTER USER 允许您为单个用户设置用户级别配置参数。这些设置会覆盖相同参数的数据库或会话级别设置。例如,以下 ALTER USER 语句将用户 Yvonne 和 Ahmed 的 DepotOperationsForQuery 设置为 FETCHES,从而覆盖默认设置 ALL:
=> SELECT user_name, parameter_name, current_value, default_value FROM user_configuration_parameters
WHERE user_name IN('Ahmed', 'Yvonne') AND parameter_name = 'DepotOperationsForQuery';
user_name | parameter_name | current_value | default_value
-----------+-------------------------+---------------+---------------
Ahmed | DepotOperationsForQuery | ALL | ALL
Yvonne | DepotOperationsForQuery | ALL | ALL
(2 rows)
=> ALTER USER Ahmed SET DepotOperationsForQuery='FETCHES';
ALTER USER
=> ALTER USER Yvonne SET DepotOperationsForQuery='FETCHES';
ALTER USER
标识用户级别参数
若要标识用户级别配置参数,请查询系统表 CONFIGURATION_PARAMETERS 的 allowed_levels
列。例如,以下查询标识会影响存储库使用的用户级别参数:
n=> SELECT parameter_name, allowed_levels, default_value, current_level, current_value
FROM configuration_parameters WHERE allowed_levels ilike '%USER%' AND parameter_name ilike '%depot%';
parameter_name | allowed_levels | default_value | current_level | current_value
-------------------------+-------------------------+---------------+---------------+---------------
UseDepotForReads | SESSION, USER, DATABASE | 1 | DEFAULT | 1
DepotOperationsForQuery | SESSION, USER, DATABASE | ALL | DEFAULT | ALL
UseDepotForWrites | SESSION, USER, DATABASE | 1 | DEFAULT | 1
(3 rows)
查看用户参数设置
可以用以下两种方式获取用户设置:
-
查询系统表 USER_CONFIGURATION_PARAMETERS:
=> SELECT * FROM user_configuration_parameters; user_name | parameter_name | current_value | default_value -----------+---------------------------+---------------+--------------- Ahmed | DepotOperationsForQuery | FETCHES | ALL Yvonne | DepotOperationsForQuery | FETCHES | ALL Yvonne | LoadSourceStatisticsLimit | 512 | 256 (3 rows)
-
使用 SHOW USER:
=> SHOW USER Yvonne PARAMETER ALL; user | parameter | setting --------+---------------------------+--------- Yvonne | DepotOperationsForQuery | FETCHES Yvonne | LoadSourceStatisticsLimit | 512 (2 rows) => SHOW USER ALL PARAMETER ALL; user | parameter | setting --------+---------------------------+--------- Yvonne | DepotOperationsForQuery | FETCHES Yvonne | LoadSourceStatisticsLimit | 512 Ahmed | DepotOperationsForQuery | FETCHES (3 rows)