11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.39 2004/03/22 03:38:24 momjian Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.40 2004/06/01 21:49:21 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -67,9 +67,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
6767
6868 <para>
6969 If <literal>WITH GRANT OPTION</literal> is specified, the recipient
70- of the privilege may in turn grant it to others. By default this
71- is not allowed. Grant options can only be granted to individual
72- users, not to groups or <literal>PUBLIC</literal>.
70+ of the privilege may in turn grant it to others. Without a grant
71+ option, the recipient cannot do that. At present, grant options can
72+ only be granted to individual users, not to groups or
73+ <literal>PUBLIC</literal>.
7374 </para>
7475
7576 <para>
@@ -79,8 +80,8 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
7980 however, choose to revoke some of his own privileges for safety.)
8081 The right to drop an object, or to alter its definition in any way is
8182 not described by a grantable privilege; it is inherent in the owner,
82- and cannot be granted or revoked. It is not possible for the owner's
83- grant options to be revoked, either .
83+ and cannot be granted or revoked. The owner implicitly has all grant
84+ options for the object, too .
8485 </para>
8586
8687 <para>
@@ -150,7 +151,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
150151 <term>RULE</term>
151152 <listitem>
152153 <para>
153- Allows the creation of a rule on the table/view. (See <xref
154+ Allows the creation of a rule on the table/view. (See the <xref
154155 linkend="sql-createrule" endterm="sql-createrule-title"> statement.)
155156 </para>
156157 </listitem>
@@ -171,7 +172,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
171172 <term>TRIGGER</term>
172173 <listitem>
173174 <para>
174- Allows the creation of a trigger on the specified table. (See
175+ Allows the creation of a trigger on the specified table. (See the
175176 <xref linkend="sql-createtrigger" endterm="sql-createtrigger-title"> statement.)
176177 </para>
177178 </listitem>
@@ -234,7 +235,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
234235 <term>ALL PRIVILEGES</term>
235236 <listitem>
236237 <para>
237- Grant all of the privileges applicable to the object at once.
238+ Grant all of the available privileges at once.
238239 The <literal>PRIVILEGES</literal> key word is optional in
239240 <productname>PostgreSQL</productname>, though it is required by
240241 strict SQL.
@@ -257,6 +258,20 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
257258 to revoke access privileges.
258259 </para>
259260
261+ <para>
262+ When a non-owner of an object attempts to <command>GRANT</> privileges
263+ on the object, the command will fail outright if the user has no
264+ privileges whatsoever on the object. As long as some privilege is
265+ available, the command will proceed, but it will grant only those
266+ privileges for which the user has grant options. The <command>GRANT ALL
267+ PRIVILEGES</> forms will issue a warning message if no grant options are
268+ held, while the other forms will issue a warning if grant options for
269+ any of the privileges specifically named in the command are not held.
270+ (In principle these statements apply to the object owner as well, but
271+ since the owner is always treated as holding all grant options, the
272+ cases can never occur.)
273+ </para>
274+
260275 <para>
261276 It should be noted that database superusers can access
262277 all objects regardless of object privilege settings. This
@@ -273,10 +288,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
273288 </para>
274289
275290 <para>
276- Currently, to grant privileges in <productname>PostgreSQL</productname>
277- to only a few columns, you must
278- create a view having the desired columns and then grant privileges
279- to that view.
291+ Currently, <productname>PostgreSQL</productname> does not support
292+ granting or revoking privileges for individual columns of a table.
293+ One possible workaround is to create a view having just the desired
294+ columns and then grant privileges to that view.
280295 </para>
281296
282297 <para>
@@ -286,9 +301,9 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
286301=> \z mytable
287302
288303 Access privileges for database "lusitania"
289- Schema | Name | Type | Access privileges
290- --------+---------+-------+-----------------------------------------------------------------
291- public | mytable | table | {=r/postgres, miriam=arwdRxt/postgres ,"group todos=arw/postgres "}
304+ Schema | Name | Type | Access privileges
305+ --------+---------+-------+------------------------------------------------------------
306+ public | mytable | table | {miriam=arwdRxt/ miriam,=r/miriam ,"group todos=arw/miriam "}
292307(1 row)
293308</programlisting>
294309 The entries shown by <command>\z</command> are interpreted thus:
@@ -331,7 +346,14 @@ and may include some privileges for <literal>PUBLIC</> depending on the
331346object type, as explained above. The first <command>GRANT</> or
332347<command>REVOKE</> on an object
333348will instantiate the default privileges (producing, for example,
334- <literal>{=,miriam=arwdRxt}</>) and then modify them per the specified request.
349+ <literal>{miriam=arwdRxt/miriam}</>) and then modify them per the
350+ specified request.
351+ </para>
352+
353+ <para>
354+ Notice that the owner's implicit grant options are not marked in the
355+ access privileges display. A <literal>*</> will appear only when
356+ grant options have been explicitly granted to someone.
335357 </para>
336358 </refsect1>
337359
@@ -347,11 +369,17 @@ GRANT INSERT ON films TO PUBLIC;
347369 </para>
348370
349371 <para>
350- Grant all privileges to user <literal>manuel</literal> on view <literal>kinds</literal>:
372+ Grant all available privileges to user <literal>manuel</literal> on view
373+ <literal>kinds</literal>:
351374
352375<programlisting>
353376GRANT ALL PRIVILEGES ON kinds TO manuel;
354377</programlisting>
378+
379+ Note that while the above will indeed grant all privileges if executed by a
380+ superuser or the owner of <literal>kinds</literal>, when executed by someone
381+ else it will only grant those permissions for which the someone else has
382+ grant options.
355383 </para>
356384 </refsect1>
357385
0 commit comments