列出用户/用户角色及其默认时区
我在 postgres 数据库中有一个表,其中包含“timestamptz”和“timestamp”列。最近我发现数据有些出入。调查后发现,有多个用户被用来插入数据。我假设根据用户角色/用户,默认时区有所不同,从而导致了差异。 例如,我相信某些查询已按如下方式执行,从而更改了用户/角色的时区
ALTER ROLE my_db_user IN DATABASE my_database
SET "TimeZone" TO 'UTC';
现在我想列出用户角色及其默认时区以及用户列表及其默认时区,而不是作为每个用户登录并找到时区作为
show timezone();
我怎样才能实现这一目标?这将帮助我确保数据完整性,即使将来某些用户的默认时区发生了变化,我也可以使用参考表来识别时区。
任何文档或查询的路径都会非常有帮助,
提前致谢
I have a table in a postgres DB that consists of "timestamptz" and "timestamp" columns. Recently I have found some discrepancies in the data. Investigating it lead to the fact that multiple users have been used to insert the data. I'm assuming based on user role/user, the default timezone varies which caused the discrepancies.
e.g. I believe some query has been executed as follows, thus changing the timezone for users / roles
ALTER ROLE my_db_user IN DATABASE my_database
SET "TimeZone" TO 'UTC';
Now I would like to list user roles and their default timezones as well as a list of users and their default timezone, Instead of login as every single user and finding the timezone as
show timezone();
How can I achieve this? This would aid me to ensure the data integrity even if in the future some user's default timezone has changed, I can use a reference table to identify the timezones.
Any path to documentation or query would be quite helpful
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将是一个查询:
This would be a query: