数据仓库服务 GAUSSDB(DWS)-ALTER DEFAULT PRIVILEGES:语法格式

时间:2024-12-24 10:32:41

语法格式

1
2
3
4
ALTER DEFAULT PRIVILEGES
    [ FOR { ROLE | USER } target_role [, ...] ]
    [ IN SCHEMA schema_name [, ...] ]
    abbreviated_grant_or_revoke;
  • 其中abbreviated_grant_or_revoke子句用于指定对哪些对象进行授权或回收权限。
    1
    2
    3
    4
    5
    6
    7
    8
    grant_on_tables_clause
      | grant_on_functions_clause
      | grant_on_types_clause
      | grant_on_sequences_clause
      | revoke_on_tables_clause
      | revoke_on_functions_clause
      | revoke_on_types_clause
      | revoke_on_sequences_clause
    
  • 其中grant_on_tables_clause子句用于对表授权。
    1
    2
    3
    4
    5
    GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFEREN CES  | TRIGGER | ANALYZE | ANALYSE | VACUUM | ALTER | DROP } 
        [, ...] | ALL [ PRIVILEGES ] }
        ON TABLES 
        TO { [ GROUP ] role_name | PUBLIC } [, ...]
        [ WITH GRANT OPTION ]
    
  • 其中grant_on_functions_clause子句用于对函数授权。
    1
    2
    3
    4
    GRANT { EXECUTE | ALL [ PRIVILEGES ] }
        ON FUNCTIONS 
        TO { [ GROUP ] role_name | PUBLIC } [, ...]
        [ WITH GRANT OPTION ]
    
  • 其中grant_on_types_clause子句用于对类型授权。
    1
    2
    3
    4
    GRANT { USAGE | ALL [ PRIVILEGES ] }
        ON TYPES 
        TO { [ GROUP ] role_name | PUBLIC } [, ...]
        [ WITH GRANT OPTION ]
    
  • 其中grant_on_sequences_clause子句用于对序列授权。
    1
    2
    3
    4
    5
    GRANT { { USAGE | SELECT | UPDATE }
        [, ...] | ALL [ PRIVILEGES ] }
        ON SEQUENCES 
        TO { [ GROUP ] role_name | PUBLIC } [, ...]
        [ WITH GRANT OPTION ]
    
  • 其中revoke_on_tables_clause子句用于回收表对象的权限。
    1
    2
    3
    4
    5
    6
    REVOKE [ GRANT OPTION FOR ]
        { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER | ANALYZE | ANALYSE | VACUUM | ALTER | DROP } 
        [, ...] | ALL [ PRIVILEGES ] }
        ON TABLES 
        FROM { [ GROUP ] role_name | PUBLIC } [, ...]
        [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
    
  • 其中revoke_on_functions_clause子句用于回收函数的权限。
    1
    2
    3
    4
    5
    REVOKE [ GRANT OPTION FOR ]
        { EXECUTE | ALL [ PRIVILEGES ] }
        ON FUNCTIONS 
        FROM { [ GROUP ] role_name | PUBLIC } [, ...]
        [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
    
  • 其中revoke_on_types_clause子句用于回收类型的权限。
    1
    2
    3
    4
    5
    REVOKE [ GRANT OPTION FOR ]
        { USAGE | ALL [ PRIVILEGES ] }
        ON TYPES 
        FROM { [ GROUP ] role_name | PUBLIC } [, ...]
        [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
    
  • 其中revoke_on_sequences_clause子句用于回收序列的权限。
    1
    2
    3
    4
    5
    6
    REVOKE [ GRANT OPTION FOR ]
        { { USAGE | SELECT | UPDATE }
        [, ...] | ALL [ PRIVILEGES ] }
        ON SEQUENCES 
        FROM { [ GROUP ] role_name | PUBLIC } [, ...]
        [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
    
support.huaweicloud.com/sqlreference-dws/dws_06_0244.html