Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 406ee67

Browse files
committed
Update some obsolete stuff in the GRANT and REVOKE reference pages:
simplify the syntax examples by unifying user and group cases, and fix no-longer-correct example of psql \z output. Per Erwin Brandstetter.
1 parent 897313e commit 406ee67

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed

doc/src/sgml/ref/grant.sgml

+25-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.66 2007/06/03 17:06:13 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.67 2007/10/30 19:43:30 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -23,34 +23,34 @@ PostgreSQL documentation
2323
GRANT { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }
2424
[,...] | ALL [ PRIVILEGES ] }
2525
ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...]
26-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
26+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
2727

2828
GRANT { { USAGE | SELECT | UPDATE }
2929
[,...] | ALL [ PRIVILEGES ] }
3030
ON SEQUENCE <replaceable class="PARAMETER">sequencename</replaceable> [, ...]
31-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
31+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
3232

3333
GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
3434
ON DATABASE <replaceable>dbname</replaceable> [, ...]
35-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
35+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
3636

3737
GRANT { EXECUTE | ALL [ PRIVILEGES ] }
3838
ON FUNCTION <replaceable>funcname</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) [, ...]
39-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
39+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
4040

4141
GRANT { USAGE | ALL [ PRIVILEGES ] }
4242
ON LANGUAGE <replaceable>langname</replaceable> [, ...]
43-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
43+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
4444

4545
GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
4646
ON SCHEMA <replaceable>schemaname</replaceable> [, ...]
47-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
47+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
4848

4949
GRANT { CREATE | ALL [ PRIVILEGES ] }
5050
ON TABLESPACE <replaceable>tablespacename</> [, ...]
51-
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
51+
TO { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
5252

53-
GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable class="PARAMETER">username</replaceable> [, ...] [ WITH ADMIN OPTION ]
53+
GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable class="PARAMETER">rolename</replaceable> [, ...] [ WITH ADMIN OPTION ]
5454
</synopsis>
5555
</refsynopsisdiv>
5656

@@ -405,18 +405,16 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
405405
to obtain information about existing privileges, for example:
406406
<programlisting>
407407
=&gt; \z mytable
408-
409-
Access privileges for database "lusitania"
410-
Schema | Name | Type | Access privileges
411-
--------+---------+-------+-----------------------------------------------------------
412-
public | mytable | table | {miriam=arwdxt/miriam,=r/miriam,"group todos=arw/miriam"}
408+
Access privileges for database "lusitania"
409+
Schema | Name | Type | Access privileges
410+
--------+---------+-------+---------------------------------------------------
411+
public | mytable | table | {miriam=arwdxt/miriam,=r/miriam,admin=arw/miriam}
413412
(1 row)
414413
</programlisting>
415414
The entries shown by <command>\z</command> are interpreted thus:
416415
<programlisting>
416+
rolename=xxxx -- privileges granted to a role
417417
=xxxx -- privileges granted to PUBLIC
418-
uname=xxxx -- privileges granted to a user
419-
group gname=xxxx -- privileges granted to a group
420418

421419
r -- SELECT ("read")
422420
w -- UPDATE ("write")
@@ -432,28 +430,28 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
432430
arwdxt -- ALL PRIVILEGES (for tables)
433431
* -- grant option for preceding privilege
434432

435-
/yyyy -- user who granted this privilege
433+
/yyyy -- role that granted this privilege
436434
</programlisting>
437435

438436
The above example display would be seen by user <literal>miriam</> after
439437
creating table <literal>mytable</> and doing:
440438

441439
<programlisting>
442440
GRANT SELECT ON mytable TO PUBLIC;
443-
GRANT SELECT, UPDATE, INSERT ON mytable TO GROUP todos;
441+
GRANT SELECT, UPDATE, INSERT ON mytable TO admin;
444442
</programlisting>
445443
</para>
446444

447445
<para>
448-
If the <quote>Access privileges</> column is empty for a given object,
449-
it means the object has default privileges (that is, its privileges column
450-
is null). Default privileges always include all privileges for the owner,
451-
and can include some privileges for <literal>PUBLIC</> depending on the
452-
object type, as explained above. The first <command>GRANT</> or
453-
<command>REVOKE</> on an object
454-
will instantiate the default privileges (producing, for example,
455-
<literal>{miriam=arwdxt/miriam}</>) and then modify them per the
456-
specified request.
446+
If the <quote>Access privileges</> column is empty for a given object,
447+
it means the object has default privileges (that is, its privileges column
448+
is null). Default privileges always include all privileges for the owner,
449+
and can include some privileges for <literal>PUBLIC</> depending on the
450+
object type, as explained above. The first <command>GRANT</> or
451+
<command>REVOKE</> on an object
452+
will instantiate the default privileges (producing, for example,
453+
<literal>{miriam=arwdxt/miriam}</>) and then modify them per the
454+
specified request.
457455
</para>
458456

459457
<para>

doc/src/sgml/ref/revoke.sgml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.45 2007/10/10 21:38:51 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.46 2007/10/30 19:43:30 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -24,48 +24,48 @@ REVOKE [ GRANT OPTION FOR ]
2424
{ { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }
2525
[,...] | ALL [ PRIVILEGES ] }
2626
ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...]
27-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
27+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
2828
[ CASCADE | RESTRICT ]
2929

3030
REVOKE [ GRANT OPTION FOR ]
3131
{ { USAGE | SELECT | UPDATE }
3232
[,...] | ALL [ PRIVILEGES ] }
3333
ON SEQUENCE <replaceable class="PARAMETER">sequencename</replaceable> [, ...]
34-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
34+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
3535
[ CASCADE | RESTRICT ]
3636

3737
REVOKE [ GRANT OPTION FOR ]
3838
{ { CREATE | CONNECT | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
3939
ON DATABASE <replaceable>dbname</replaceable> [, ...]
40-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
40+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
4141
[ CASCADE | RESTRICT ]
4242

4343
REVOKE [ GRANT OPTION FOR ]
4444
{ EXECUTE | ALL [ PRIVILEGES ] }
4545
ON FUNCTION <replaceable>funcname</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) [, ...]
46-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
46+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
4747
[ CASCADE | RESTRICT ]
4848

4949
REVOKE [ GRANT OPTION FOR ]
5050
{ USAGE | ALL [ PRIVILEGES ] }
5151
ON LANGUAGE <replaceable>langname</replaceable> [, ...]
52-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
52+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
5353
[ CASCADE | RESTRICT ]
5454

5555
REVOKE [ GRANT OPTION FOR ]
5656
{ { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
5757
ON SCHEMA <replaceable>schemaname</replaceable> [, ...]
58-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
58+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
5959
[ CASCADE | RESTRICT ]
6060

6161
REVOKE [ GRANT OPTION FOR ]
6262
{ CREATE | ALL [ PRIVILEGES ] }
6363
ON TABLESPACE <replaceable>tablespacename</replaceable> [, ...]
64-
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
64+
FROM { [ GROUP ] <replaceable class="PARAMETER">rolename</replaceable> | PUBLIC } [, ...]
6565
[ CASCADE | RESTRICT ]
6666

6767
REVOKE [ ADMIN OPTION FOR ]
68-
<replaceable class="PARAMETER">role</replaceable> [, ...] FROM <replaceable class="PARAMETER">username</replaceable> [, ...]
68+
<replaceable class="PARAMETER">role</replaceable> [, ...] FROM <replaceable class="PARAMETER">rolename</replaceable> [, ...]
6969
[ CASCADE | RESTRICT ]
7070
</synopsis>
7171
</refsynopsisdiv>
@@ -107,7 +107,7 @@ REVOKE [ ADMIN OPTION FOR ]
107107
called dependent privileges. If the privilege or the grant option
108108
held by the first user is being revoked and dependent privileges
109109
exist, those dependent privileges are also revoked if
110-
<literal>CASCADE</literal> is specified, else the revoke action
110+
<literal>CASCADE</literal> is specified; if it is not, the revoke action
111111
will fail. This recursive revocation only affects privileges that
112112
were granted through a chain of users that is traceable to the user
113113
that is the subject of this <literal>REVOKE</literal> command.

0 commit comments

Comments
 (0)