简体   繁体   English

ALTER ROLE SET设置位置

[英]ALTER ROLE SET settings location

I have been going through the documentation about setting PG parameters. 我一直在浏览有关设置PG参数的文档。 I understand the behavior of postgresql.conf and postgresql.auto.conf , especially with ALTER SYSTEM variants and the SUPERUSER requirements for these cluster-wide defaults. 我了解postgresql.confpostgresql.auto.conf的行为,尤其是对于ALTER SYSTEM变体和这些群集范围默认值的SUPERUSER要求。

I recently came across ALTER ROLE SET which allows regular users to set USER context settings and persistent them (changes first seen on next login and updated only on logins). 最近,我遇到了ALTER ROLE SET ,它允许普通用户设置USER上下文设置并对其进行持久化(更改在下次登录时首次看到,仅在登录时才更新)。 These values rightly don't appear in the above .conf files - but they must be saved somewhere since they persist to future sessions. 这些值正确地不会出现在上面的.conf文件中-但是必须将它们保存在某个位置,因为它们会保留到以后的会话中。 pg_settings does reflect the change in the setting column after logging in, but source is still user so there's no way to tell that it came from a persisted value on ROLE as opposed to some session-duration setting. pg_settings确实在登录后反映了设置列中的更改,但是source仍然是用户,因此无法断定它来自ROLE上的持久值,而不是某些会话持续时间设置。

Where are these ALTER ROLE SET values kept? 这些ALTER ROLE SET值保存在哪里? If ALTER ROLE SET executes, is it guaranteed that if the server restarts or is PITR'd that this change stays? 如果执行ALTER ROLE SET ,是否可以确保服务器重新启动还是PITR保留此更改? And why doesn't the source reflect something like 'role' to differentiate? 为何来源没有反映出类似于“角色”这样的区别?

This information is kept in the pg_db_role_setting catalog. 该信息保存在pg_db_role_setting目录中。

Consequently, these changes are persistent. 因此,这些变化是持久的。

pg_settings will show the source as user , which is all the information you need, because it must be set on current_user . pg_settings会将source显示为user ,这是您需要的所有信息,因为必须在current_user上进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM