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

时间:2025-01-26 10:51:15

语法格式

1234
ALTER DEFAULT PRIVILEGES    [ FOR { ROLE | USER } target_role [, ...] ]    [ IN SCHEMA schema_name [, ...] ]    abbreviated_grant_or_revoke;
  • 其中abbreviated_grant_or_revoke子句用于指定对哪些对象进行授权或回收权限。
    12345678
    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子句用于对表授权。
    12345
    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子句用于对函数授权。
    1234
    GRANT { { EXECUTE | ALTER | DROP } [, ...] | ALL [ PRIVILEGES ] }    ON FUNCTIONS     TO { [ GROUP ] role_name | PUBLIC } [, ...]    [ WITH GRANT OPTION ]
  • 其中grant_on_types_clause子句用于对类型授权。
    1234
    GRANT { USAGE | ALL [ PRIVILEGES ] }    ON TYPES     TO { [ GROUP ] role_name | PUBLIC } [, ...]    [ WITH GRANT OPTION ]
  • 其中grant_on_sequences_clause子句用于对序列授权。
    12345
    GRANT { { USAGE | SELECT | UPDATE }    [, ...] | ALL [ PRIVILEGES ] }    ON SEQUENCES     TO { [ GROUP ] role_name | PUBLIC } [, ...]    [ WITH GRANT OPTION ]
  • 其中revoke_on_tables_clause子句用于回收表对象的权限。
    123456
    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子句用于回收函数的权限。
    12345
    REVOKE [ GRANT OPTION FOR ]    { { EXECUTE | ALTER | DROP } [, ...] | ALL [ PRIVILEGES ] }    ON FUNCTIONS     FROM { [ GROUP ] role_name | PUBLIC } [, ...]    [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
  • 其中revoke_on_types_clause子句用于回收类型的权限。
    12345
    REVOKE [ GRANT OPTION FOR ]    { USAGE | ALL [ PRIVILEGES ] }    ON TYPES     FROM { [ GROUP ] role_name | PUBLIC } [, ...]    [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
  • 其中revoke_on_sequences_clause子句用于回收序列的权限。
    123456
    REVOKE [ GRANT OPTION FOR ]    { { USAGE | SELECT | UPDATE }    [, ...] | ALL [ PRIVILEGES ] }    ON SEQUENCES     FROM { [ GROUP ] role_name | PUBLIC } [, ...]    [ CASCADE | RESTRICT | CASCADE CONSTRAINTS ]
support.huaweicloud.com/sqlreference-910-dws/dws_06_0244.html