Imported upstream version 1.5
[manpages-zh.git] / raw / man7 / revoke.7
blob3560247b8ecade5665aae17908d38d074d8b4fed
1 .\\" auto-generated by docbook2man-spec $Revision: 1.1 $
2 .TH "REVOKE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands"
3 .SH NAME
4 REVOKE \- remove access privileges
6 .SH SYNOPSIS
7 .sp
8 .nf
9 REVOKE [ GRANT OPTION FOR ]
10     { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }
11     [,...] | ALL [ PRIVILEGES ] }
12     ON [ TABLE ] \fItablename\fR [, ...]
13     FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]
14     [ CASCADE | RESTRICT ]
16 REVOKE [ GRANT OPTION FOR ]
17     { { CREATE | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
18     ON DATABASE \fIdbname\fR [, ...]
19     FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]
20     [ CASCADE | RESTRICT ]
22 REVOKE [ GRANT OPTION FOR ]
23     { EXECUTE | ALL [ PRIVILEGES ] }
24     ON FUNCTION \fIfuncname\fR ([\fItype\fR, ...]) [, ...]
25     FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]
26     [ CASCADE | RESTRICT ]
28 REVOKE [ GRANT OPTION FOR ]
29     { USAGE | ALL [ PRIVILEGES ] }
30     ON LANGUAGE \fIlangname\fR [, ...]
31     FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]
32     [ CASCADE | RESTRICT ]
34 REVOKE [ GRANT OPTION FOR ]
35     { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
36     ON SCHEMA \fIschemaname\fR [, ...]
37     FROM { \fIusername\fR | GROUP \fIgroupname\fR | PUBLIC } [, ...]
38     [ CASCADE | RESTRICT ]
39 .sp
40 .fi
41 .SH "DESCRIPTION"
42 .PP
43 The \fBREVOKE\fR command revokes previously granted
44 privileges from one or more users or groups of users. The key word
45 PUBLIC refers to the implicitly defined group of
46 all users.
47 .PP
48 See the description of the GRANT [\fBgrant\fR(7)] command for
49 the meaning of the privilege types.
50 .PP
51 Note that any particular user will have the sum
52 of privileges granted directly to him, privileges granted to any group he
53 is presently a member of, and privileges granted to
54 PUBLIC. Thus, for example, revoking SELECT privilege
55 from PUBLIC does not necessarily mean that all users
56 have lost SELECT privilege on the object: those who have it granted
57 directly or via a group will still have it.
58 .PP
59 If GRANT OPTION FOR is specified, only the grant
60 option for the privilege is revoked, not the privilege itself.
61 .PP
62 If a user holds a privilege with grant option and has granted it to
63 other users then the privileges held by those other users are
64 called dependent privileges. If the privilege or the grant option
65 held by the first user is being revoked and dependent privileges
66 exist, those dependent privileges are also revoked if
67 CASCADE is specified, else the revoke action
68 will fail. This recursive revocation only affects privileges that
69 were granted through a chain of users that is traceable to the user
70 that is the subject of this REVOKE command.
71 Thus, the affected users may effectively keep the privilege if it
72 was also granted through other users.
73 .SH "NOTES"
74 .PP
75 Use \fBpsql\fR(1)'s \fB\\z\fR command to
76 display the privileges granted on existing objects. See also GRANT [\fBgrant\fR(7)] for information about the format.
77 .PP
78 A user can only revoke privileges that were granted directly by
79 that user. If, for example, user A has granted a privilege with
80 grant option to user B, and user B has in turned granted it to user
81 C, then user A cannot revoke the privilege directly from C.
82 Instead, user A could revoke the grant option from user B and use
83 the CASCADE option so that the privilege is
84 automatically revoked from user C.
85 .PP
86 If a superuser chooses to issue a \fBGRANT\fR or \fBREVOKE\fR
87 command, the command is performed as though it were issued by the
88 owner of the affected object. Since all privileges ultimately come
89 from the object owner (possibly indirectly via chains of grant options),
90 it is possible for a superuser to revoke all privileges, but this may
91 require use of CASCADE as stated above.
92 .SH "EXAMPLES"
93 .PP
94 Revoke insert privilege for the public on table
95 films:
96 .sp
97 .nf
98 REVOKE INSERT ON films FROM PUBLIC;
99 .sp
102 Revoke all privileges from user manuel on view kinds:
105   
106 REVOKE ALL PRIVILEGES ON kinds FROM manuel;
109 .SH "COMPATIBILITY"
111 The compatibility notes of the GRANT [\fBgrant\fR(7)] command
112 apply analogously to \fBREVOKE\fR. The syntax summary is:
115 REVOKE [ GRANT OPTION FOR ] \fIprivileges\fR
116     ON \fIobject\fR [ ( \fIcolumn\fR [, ...] ) ]
117     FROM { PUBLIC | \fIusername\fR [, ...] }
118     { RESTRICT | CASCADE }
121 One of RESTRICT or CASCADE
122 is required according to the standard, but PostgreSQL
123 assumes RESTRICT by default.
124 .SH "SEE ALSO"
126 GRANT [\fBgrant\fR(7)]