【问题标题】:Redshift - Find user group for the user idRedshift - 查找用户 ID 的用户组
【发布时间】:2021-10-23 16:08:00
【问题描述】:

Redshift 有许多用于查询指标的系统表。大多数表都有一个名为userid 的列,它是pg_user 表中的确切用户ID。我想通过使用 pg_group 加入 userid 列来获取该特定用户的组名,但它不起作用。

参考链接:https://stackoverflow.com/a/51950747/6885516

我试过的查询:

select a.*,b.groname from svl_s3query_summary a, pg_group b  where
a.userid = ANY(b.grolist) and 
b.groname='analytics';

错误信息:

Column "b.grolist" has unsupported type "integer[]".
Column "*NEW*.xid" has unsupported type "integer[]".

【问题讨论】:

    标签: amazon-redshift


    【解决方案1】:

    这里比较中使用的列是不同的数据类型

    即 a.userid = ANY(b.grolist)

    userid 是整数,但 grolist 是整数数组或整数数组[]

    pg_group schema

    https://www.postgresql.org/docs/9.1/view-pg-group.html

    【讨论】:

      猜你喜欢
      • 2019-08-12
      • 2017-10-04
      • 1970-01-01
      • 2021-05-21
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      • 1970-01-01
      相关资源
      最近更新 更多