revoke.7

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 194 行

7
194
字号
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "REVOKE" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMEREVOKE \- remove access privileges.SH SYNOPSIS.sp.nfREVOKE [ GRANT OPTION FOR ]    { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }    [,...] | ALL [ PRIVILEGES ] }    ON [ TABLE ] \fItablename\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { { USAGE | SELECT | UPDATE }    [,...] | ALL [ PRIVILEGES ] }    ON SEQUENCE \fIsequencename\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }    ON DATABASE \fIdbname\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { EXECUTE | ALL [ PRIVILEGES ] }    ON FUNCTION \fIfuncname\fR ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, ...] ] ) [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { USAGE | ALL [ PRIVILEGES ] }    ON LANGUAGE \fIlangname\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }    ON SCHEMA \fIschemaname\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ GRANT OPTION FOR ]    { CREATE | ALL [ PRIVILEGES ] }    ON TABLESPACE \fItablespacename\fR [, ...]    FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]    [ CASCADE | RESTRICT ]REVOKE [ ADMIN OPTION FOR ]    \fIrole\fR [, ...] FROM \fIusername\fR [, ...]    [ CASCADE | RESTRICT ].sp.fi.SH "DESCRIPTION".PPThe \fBREVOKE\fR command revokes previously grantedprivileges from one or more roles. The key wordPUBLIC refers to the implicitly defined group ofall roles..PPSee the description of the GRANT [\fBgrant\fR(7)] command forthe meaning of the privilege types..PPNote that any particular role will have the sumof privileges granted directly to it, privileges granted to any role itis presently a member of, and privileges granted toPUBLIC. Thus, for example, revoking SELECT privilegefrom PUBLIC does not necessarily mean that all roleshave lost SELECT privilege on the object: those who have it granteddirectly or via another role will still have it..PPIf GRANT OPTION FOR is specified, only the grantoption for the privilege is revoked, not the privilege itself.Otherwise, both the privilege and the grant option are revoked..PPIf a user holds a privilege with grant option and has granted it toother users then the privileges held by those other users arecalled dependent privileges. If the privilege or the grant optionheld by the first user is being revoked and dependent privilegesexist, those dependent privileges are also revoked ifCASCADE is specified, else the revoke actionwill fail. This recursive revocation only affects privileges thatwere granted through a chain of users that is traceable to the userthat is the subject of this REVOKE command.Thus, the affected users may effectively keep the privilege if itwas also granted through other users..PPWhen revoking membership in a role, GRANT OPTION is insteadcalled ADMIN OPTION, but the behavior is similar.Note also that this form of the command does notallow the noise word GROUP..SH "NOTES".PPUse \fBpsql\fR(1)'s \fB\\z\fR command todisplay the privileges granted on existing objects. See GRANT [\fBgrant\fR(7)] for information about the format..PPA user can only revoke privileges that were granted directly bythat user. If, for example, user A has granted a privilege withgrant option to user B, and user B has in turned granted it to userC, then user A cannot revoke the privilege directly from C.Instead, user A could revoke the grant option from user B and usethe CASCADE option so that the privilege isin turn revoked from user C. For another example, if both A and Bhave granted the same privilege to C, A can revoke his own grantbut not B's grant, so C will still effectively have the privilege..PPWhen a non-owner of an object attempts to \fBREVOKE\fR privilegeson the object, the command will fail outright if the user has noprivileges whatsoever on the object. As long as some privilege isavailable, the command will proceed, but it will revoke only thoseprivileges for which the user has grant options. The \fBREVOKE ALLPRIVILEGES\fR forms will issue a warning message if no grant options areheld, while the other forms will issue a warning if grant options forany of the privileges specifically named in the command are not held.(In principle these statements apply to the object owner as well, butsince the owner is always treated as holding all grant options, thecases can never occur.).PPIf a superuser chooses to issue a \fBGRANT\fR or \fBREVOKE\fRcommand, the command is performed as though it were issued by theowner of the affected object. Since all privileges ultimately comefrom the object owner (possibly indirectly via chains of grant options),it is possible for a superuser to revoke all privileges, but this mayrequire use of CASCADE as stated above..PP\fBREVOKE\fR can also be done by a rolethat is not the owner of the affected object, but is a member of the rolethat owns the object, or is a member of a role that holds privilegesWITH GRANT OPTION on the object. In this case thecommand is performed as though it were issued by the containing role thatactually owns the object or holds the privilegesWITH GRANT OPTION. For example, if tablet1 is owned by role g1, of which roleu1 is a member, then u1 can revoke privilegeson t1 that are recorded as being granted by g1.This would include grants made by u1 as well as by othermembers of role g1..PPIf the role executing \fBREVOKE\fR holds privilegesindirectly via more than one role membership path, it is unspecifiedwhich containing role will be used to perform the command. In such casesit is best practice to use \fBSET ROLE\fR to become the specificrole you want to do the \fBREVOKE\fR as. Failure to do so maylead to revoking privileges other than the ones you intended, or notrevoking anything at all..SH "EXAMPLES".PPRevoke insert privilege for the public on tablefilms:.sp.nfREVOKE INSERT ON films FROM PUBLIC;.sp.fi.PPRevoke all privileges from user manuel on viewkinds:.sp.nfREVOKE ALL PRIVILEGES ON kinds FROM manuel;.sp.fiNote that this actually means ``revoke all privileges that Igranted''..PPRevoke membership in role admins from user joe:.sp.nfREVOKE admins FROM joe;.sp.fi.SH "COMPATIBILITY".PPThe compatibility notes of the GRANT [\fBgrant\fR(7)] commandapply analogously to \fBREVOKE\fR. The syntax summary is:.sp.nfREVOKE [ GRANT OPTION FOR ] \fIprivileges\fR    ON \fIobject\fR [ ( \fIcolumn\fR [, ...] ) ]    FROM { PUBLIC | \fIusername\fR [, ...] }    { RESTRICT | CASCADE }.sp.fiOne of RESTRICT or CASCADEis required according to the standard, but PostgreSQLassumes RESTRICT by default..SH "SEE ALSO".PPGRANT [\fBgrant\fR(7)]

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?