1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.22 2002/04/21 00:26:42 tgl Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/grant.sgml,v 1.23 2002/04/22 19:17:40 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -157,11 +157,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
157
157
<term>CREATE</term>
158
158
<listitem>
159
159
<para>
160
- For databases, allows new schemas to be createdin the database.
160
+ For databases, allows new schemas to be createdwithin the database.
161
161
</para>
162
162
<para>
163
- For schemas, allows new objects to be created within the specified
164
- schema.
163
+ For schemas, allows new objects to be created within the schema.
165
164
</para>
166
165
</listitem>
167
166
</varlistentry>
@@ -196,9 +195,9 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
196
195
of privilege that is applicable to procedural languages.
197
196
</para>
198
197
<para>
199
- For schemas, allowsthe use of objects contained in the specified
198
+ For schemas, allowsaccess to objects contained in the specified
200
199
schema (assuming that the objects' own privilege requirements are
201
- met). Essentially this allows the grantee to <quote>look up</>
200
+ also met). Essentially this allows the grantee to <quote>look up</>
202
201
objects within the schema.
203
202
</para>
204
203
</listitem>
@@ -226,6 +225,11 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
226
225
<refsect1 id="SQL-GRANT-notes">
227
226
<title>Notes</title>
228
227
228
+ <para>
229
+ The <xref linkend="sql-revoke" endterm="sql-revoke-title"> command is used
230
+ to revoke access privileges.
231
+ </para>
232
+
229
233
<para>
230
234
It should be noted that database <firstterm>superusers</> can access
231
235
all objects regardless of object privilege settings. This
@@ -243,19 +247,19 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
243
247
244
248
<para>
245
249
Use <xref linkend="app-psql">'s <command>\z</command> command
246
- to obtain information about privileges
247
- on existing objects:
250
+ to obtain information about existing privileges, for example:
251
+ <programlisting>
252
+ lusitania=> \z mytable
253
+ Access privileges for database "lusitania"
254
+ Table | Access privileges
255
+ ---------+---------------------------------------
256
+ mytable | {=r,miriam=arwdRxt,"group todos=arw"}
257
+ </programlisting>
258
+ The entries shown by <command>\z</command> are interpreted thus:
248
259
<programlisting>
249
- Database = lusitania
250
- +------------------+---------------------------------------------+
251
- | Relation | Grant/Revoke Permissions |
252
- +------------------+---------------------------------------------+
253
- | mytable | {"=rw","miriam=arwdRxt","group todos=rw"} |
254
- +------------------+---------------------------------------------+
255
- Legend:
256
- uname=arwR -- privileges granted to a user
257
- group gname=arwR -- privileges granted to a group
258
- =arwR -- privileges granted to PUBLIC
260
+ =xxxx -- privileges granted to PUBLIC
261
+ uname=xxxx -- privileges granted to a user
262
+ group gname=xxxx -- privileges granted to a group
259
263
260
264
r -- SELECT ("read")
261
265
w -- UPDATE ("write")
@@ -269,12 +273,25 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
269
273
C -- CREATE
270
274
T -- TEMPORARY
271
275
arwdRxt -- ALL PRIVILEGES (for tables)
276
+ </programlisting>
277
+
278
+ The above example display would be seen by user <literal>miriam</> after
279
+ creating table <literal>mytable</> and doing
280
+
281
+ <programlisting>
282
+ GRANT SELECT ON mytable TO PUBLIC;
283
+ GRANT SELECT,UPDATE,INSERT ON mytable TO GROUP todos;
272
284
</programlisting>
273
285
</para>
274
286
275
287
<para>
276
- The <xref linkend="sql-revoke" endterm="sql-revoke-title"> command is used to revoke access
277
- privileges.
288
+ If the <quote>Access privileges</> column is empty for a given object,
289
+ it means the object has default privileges (that is, its privileges field
290
+ is NULL). Currently, default privileges are interpreted the same way
291
+ for all object types: all privileges for the owner and no privileges for
292
+ anyone else. The first <command>GRANT</> on an object will instantiate
293
+ this default (producing, for example, <literal>{=,miriam=arwdRxt}</>)
294
+ and then modify it per the specified request.
278
295
</para>
279
296
</refsect1>
280
297