Redshift Observatory

System Table Tracker

System view pg_catalog.svv_iam_privileges version 1.0.52931 / 2023-07-07

schema name column data type
pg_catalog svv_iam_privileges command_type varchar(128)
pg_catalog svv_iam_privileges iam_arn varchar(128)
pg_catalog svv_iam_privileges identity_id int4
pg_catalog svv_iam_privileges identity_name varchar(128)
pg_catalog svv_iam_privileges identity_type varchar(128)

View Text

SELECT CAST(derived_table5.iam_arn AS varchar(128)) AS iam_arn,
       CAST(CASE
              WHEN derived_table5.priv_id = CAST(0 AS oid)
                THEN CAST('COPY' AS text)
              WHEN derived_table5.priv_id = CAST(1 AS oid)
                THEN CAST('UNLOAD' AS text)
              WHEN derived_table5.priv_id = CAST(2 AS oid)
                THEN CAST('CREATE MODEL' AS text)
              WHEN derived_table5.priv_id = CAST(3 AS oid)
                THEN CAST('EXFUNC' AS text)
              WHEN derived_table5.priv_id = CAST(4 AS oid)
                THEN CAST('CREATE LIBRARY' AS text)
              WHEN derived_table5.priv_id = CAST(5 AS oid)
                THEN CAST('EXTERNAL SCHEMA' AS text)
              ELSE CAST('UNKOWN' AS text)
            END AS varchar(128)) AS command_type,
       derived_table5.identity_id,
       CAST(derived_table5.identity_name AS varchar(128)) AS identity_name,
       CAST(derived_table5.identity_type AS varchar(128)) AS identity_type
FROM (((SELECT CAST(perms.iamarn AS varchar) AS iam_arn,
               perms.privid AS priv_id,
               accessible_users.useid AS identity_id,
               accessible_users.usename AS identity_name,
               CAST('user' AS varchar) AS identity_type
        FROM pg_user_permission
             INNER JOIN (SELECT pg_permission.permid,
                                pg_iam_permission.iamarn,
                                pg_permission.privid
                         FROM pg_permission
                              INNER JOIN pg_iam_permission ON pg_iam_permission.oid = pg_permission.objid
                         WHERE pg_permission.dbid = CAST(0 AS oid)
                           AND pg_permission.privtype = 1
                           AND pg_permission.objtype = CAST(2798 AS oid)
                           AND pg_permission.objsubid = 0) AS perms ON perms.permid = pg_user_permission.permid
             INNER JOIN (SELECT pg_identity.useid,
                                pg_identity.usename
                         FROM pg_identity
                         WHERE pg_identity.usename !~~ CAST('f346c9b8%' AS text)
                           AND (EXISTS (SELECT 1
                                        FROM pg_identity
                                        WHERE pg_identity.useid = current_user_id()
                                          AND pg_identity.usesuper = TRUE)
                             OR has_system_privilege(CAST("current_user"() AS name),
                                                     CAST('ACCESS SYSTEM TABLE' AS text))
                             OR pg_identity.useid = current_user_id())) AS accessible_users ON accessible_users.useid = pg_user_permission.userid

        UNION

        SELECT CAST(perms.iamarn AS varchar) AS iam_arn,
               perms.privid AS priv_id,
               pg_role_permission.roleid AS identity_id,
               accessible_roles.rolname AS identity_name,
               CAST('role' AS varchar) AS identity_type
        FROM pg_role_permission
             INNER JOIN (SELECT pg_permission.permid,
                                pg_iam_permission.iamarn,
                                pg_permission.privid
                         FROM pg_permission
                              INNER JOIN pg_iam_permission ON pg_iam_permission.oid = pg_permission.objid
                         WHERE pg_permission.dbid = CAST(0 AS oid)
                           AND pg_permission.privtype = 1
                           AND pg_permission.objtype = CAST(2798 AS oid)
                           AND pg_permission.objsubid = 0) AS perms ON perms.permid = pg_role_permission.permid
             INNER JOIN (SELECT pg_role.rolid,
                                pg_role.rolname
                         FROM pg_role
                         WHERE pg_role.rolname !~~ CAST('/%' AS text)
                           AND (EXISTS (SELECT 1
                                        FROM pg_identity
                                        WHERE pg_identity.useid = current_user_id()
                                          AND pg_identity.usesuper = TRUE)
                             OR has_system_privilege(CAST("current_user"() AS name),
                                                     CAST('ACCESS SYSTEM TABLE' AS text))
                             OR user_is_member_of(CAST("current_user"() AS name),
                                                  pg_role.rolname)
                             OR current_user_id() = pg_role.rolowner)) AS accessible_roles ON accessible_roles.rolid = pg_role_permission.roleid)

       UNION

       SELECT CAST(perms.iamarn AS varchar) AS iam_arn,
              perms.privid AS priv_id,
              pg_role_permission.roleid AS identity_id,
              accessible_groups.groname AS identity_name,
              CAST('group' AS varchar) AS identity_type
       FROM pg_role_permission
            INNER JOIN (SELECT pg_permission.permid,
                               pg_iam_permission.iamarn,
                               pg_permission.privid
                        FROM pg_permission
                             INNER JOIN pg_iam_permission ON pg_iam_permission.oid = pg_permission.objid
                        WHERE pg_permission.dbid = CAST(0 AS oid)
                          AND pg_permission.privtype = 1
                          AND pg_permission.objtype = CAST(2798 AS oid)
                          AND pg_permission.objsubid = 0) AS perms ON perms.permid = pg_role_permission.permid
            INNER JOIN (SELECT pg_group.groname,
                               pg_group.grosysid
                        FROM pg_group
                        WHERE EXISTS (SELECT 1
                                      FROM pg_identity
                                      WHERE pg_identity.useid = current_user_id()
                                        AND pg_identity.usesuper = TRUE)
                           OR has_system_privilege(CAST("current_user"() AS name),
                                                   CAST('ACCESS SYSTEM TABLE' AS text))
                           OR user_is_member_of(CAST("current_user"() AS name),
                                                pg_group.groname)) AS accessible_groups ON accessible_groups.grosysid = pg_role_permission.roleid)

      UNION

      SELECT CAST(perms.iamarn AS varchar) AS iam_arn,
             perms.privid AS priv_id,
             0 AS identity_id,
             CAST('public' AS name) AS identity_name,
             CAST('public' AS varchar) AS identity_type
      FROM (SELECT pg_permission.permid,
                   pg_iam_permission.iamarn,
                   pg_permission.privid
            FROM pg_permission
                 INNER JOIN pg_iam_permission ON pg_iam_permission.oid = pg_permission.objid
            WHERE pg_permission.dbid = CAST(0 AS oid)
              AND pg_permission.privtype = 1
              AND pg_permission.objtype = CAST(2798 AS oid)
              AND pg_permission.objsubid = 0) AS perms
      WHERE pg_perm_has_public_grantee(perms.permid)) AS derived_table5


Home 3D Друк Blog Bring-Up Times Consultancy Cross-Region Benchmarks Email Forums IRC Mailing Lists Reddit Redshift Price Tracker Redshift Version Tracker Redshift Workbench System Table Tracker The Known Universe Twitter White Papers