]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/revoke.sgml
6a858c5b3dff638e708d03390161a9f9960568ac
[postgresql] / doc / src / sgml / ref / revoke.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.19 2001/12/08 03:24:39 thomas Exp $
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-REVOKE">
7  <refmeta>
8   <refentrytitle id="sql-revoke-title">REVOKE</refentrytitle>
9   <refmiscinfo>SQL - Language Statements</refmiscinfo>
10  </refmeta>
11
12  <refnamediv>
13   <refname>REVOKE</refname>
14   <refpurpose>remove access privileges</refpurpose>
15  </refnamediv>
16
17  <refsynopsisdiv>
18 <synopsis>
19 REVOKE { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] }
20     ON [ TABLE ] <replaceable class="PARAMETER">object</replaceable> [, ...]
21     FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
22 </synopsis>
23  </refsynopsisdiv>
24
25  <refsect1 id="SQL-REVOKE-description">
26   <title>Description</title>
27
28   <para>
29    <command>REVOKE</command> allows the creator of an object to revoke
30    previously granted permissions from one or more users or groups of users.
31    The key word <literal>PUBLIC</literal> refers to the implicitly defined
32    group of all users.
33   </para>
34
35   <para>
36    Note that any particular user will have the sum
37    of privileges granted directly to him, privileges granted to any group he
38    is presently a member of, and privileges granted to
39    <literal>PUBLIC</literal>.  Thus, for example, revoking SELECT privilege
40    from <literal>PUBLIC</literal> does not necessarily mean that all users
41    have lost SELECT privilege on the object: those who have it granted
42    directly or via a group will still have it.
43   </para>
44
45   <para>
46    See the description of the <xref linkend="sql-grant" endterm="sql-grant-title"> command for
47    the meaning of the privilege types.
48   </para>
49  </refsect1>
50
51  <refsect1 id="SQL-REVOKE-notes">
52   <title>Notes</title>
53
54   <para>
55    Use <xref linkend="app-psql">'s <command>\z</command> command to
56    display the privileges granted on existing objects.  See also <xref
57    linkend="sql-grant"> for information about the format.
58   </para>
59  </refsect1>
60
61  <refsect1 id="SQL-REVOKE-examples">
62   <title>Examples</title>
63
64   <para>
65    Revoke insert privilege for the public on table
66    <literal>films</literal>:
67
68 <programlisting>
69 REVOKE INSERT ON films FROM PUBLIC;
70 </programlisting>
71   </para>
72
73   <para>
74    Revoke all privileges from user <literal>manuel</literal> on view <literal>kinds</literal>:
75
76 <programlisting>  
77 REVOKE ALL PRIVILEGES ON kinds FROM manuel;
78 </programlisting>
79   </para>
80  </refsect1>
81
82  <refsect1 id="SQL-REVOKE-compatibility">
83   <title>Compatibility</title>
84
85   <refsect2>
86    <title>SQL92</title>
87
88    <para>
89     The compatibility notes of the <xref linkend="sql-grant" endterm="sql-grant-title"> command
90     apply analogously to <command>REVOKE</command>.  The syntax summary is:
91
92 <synopsis>
93 REVOKE [ GRANT OPTION FOR ] { SELECT | INSERT | UPDATE | DELETE | REFERENCES }
94     ON <replaceable class="parameter">object</replaceable> [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ]
95     FROM { PUBLIC | <replaceable class="parameter">username</replaceable> [, ...] }
96     { RESTRICT | CASCADE }
97 </synopsis>
98    </para>
99
100    <para> 
101     If user1 gives a privilege WITH GRANT OPTION to user2,
102     and user2 gives it to user3 then user1 can revoke
103     this privilege in cascade using the CASCADE keyword.
104     If user1 gives a privilege WITH GRANT OPTION to user2,
105     and user2 gives it to user3, then if user1 tries to revoke
106     this privilege it fails if he specifies the RESTRICT
107     keyword.
108    </para>
109   </refsect2>
110  </refsect1>
111
112  <refsect1>
113   <title>See Also</title>
114
115   <simpara>
116    <xref linkend="sql-grant">
117   </simpara>
118  </refsect1>
119
120 </refentry>
121
122 <!-- Keep this comment at the end of the file
123 Local variables:
124 mode: sgml
125 sgml-omittag:nil
126 sgml-shorttag:t
127 sgml-minimize-attributes:nil
128 sgml-always-quote-attributes:t
129 sgml-indent-step:1
130 sgml-indent-data:t
131 sgml-parent-document:nil
132 sgml-default-dtd-file:"../reference.ced"
133 sgml-exposed-tags:nil
134 sgml-local-catalogs:"/usr/lib/sgml/catalog"
135 sgml-local-ecat-files:nil
136 End:
137 -->