1
1
<!--
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 $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -67,9 +67,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
67
67
68
68
<para>
69
69
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>.
73
74
</para>
74
75
75
76
<para>
@@ -79,8 +80,8 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
79
80
however, choose to revoke some of his own privileges for safety.)
80
81
The right to drop an object, or to alter its definition in any way is
81
82
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 .
84
85
</para>
85
86
86
87
<para>
@@ -150,7 +151,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
150
151
<term>RULE</term>
151
152
<listitem>
152
153
<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
154
155
linkend="sql-createrule" endterm="sql-createrule-title"> statement.)
155
156
</para>
156
157
</listitem>
@@ -171,7 +172,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
171
172
<term>TRIGGER</term>
172
173
<listitem>
173
174
<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
175
176
<xref linkend="sql-createtrigger" endterm="sql-createtrigger-title"> statement.)
176
177
</para>
177
178
</listitem>
@@ -234,7 +235,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
234
235
<term>ALL PRIVILEGES</term>
235
236
<listitem>
236
237
<para>
237
- Grant all of the privileges applicable to the object at once.
238
+ Grant all of the available privileges at once.
238
239
The <literal>PRIVILEGES</literal> key word is optional in
239
240
<productname>PostgreSQL</productname>, though it is required by
240
241
strict SQL.
@@ -257,6 +258,20 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
257
258
to revoke access privileges.
258
259
</para>
259
260
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
+
260
275
<para>
261
276
It should be noted that database superusers can access
262
277
all objects regardless of object privilege settings. This
@@ -273,10 +288,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
273
288
</para>
274
289
275
290
<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.
280
295
</para>
281
296
282
297
<para>
@@ -286,9 +301,9 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
286
301
=> \z mytable
287
302
288
303
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 "}
292
307
(1 row)
293
308
</programlisting>
294
309
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
331
346
object type, as explained above. The first <command>GRANT</> or
332
347
<command>REVOKE</> on an object
333
348
will 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.
335
357
</para>
336
358
</refsect1>
337
359
@@ -347,11 +369,17 @@ GRANT INSERT ON films TO PUBLIC;
347
369
</para>
348
370
349
371
<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>:
351
374
352
375
<programlisting>
353
376
GRANT ALL PRIVILEGES ON kinds TO manuel;
354
377
</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.
355
383
</para>
356
384
</refsect1>
357
385
0 commit comments