Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48d25ba

Browse files
committed
Merge two documentation permission chapters into a single chapter.
1 parent087bd17 commit48d25ba

File tree

2 files changed

+38
-94
lines changed

2 files changed

+38
-94
lines changed

‎doc/src/sgml/ddl.sgml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,13 +1400,33 @@ ALTER TABLE products RENAME TO items;
14001400
<see>privilege</see>
14011401
</indexterm>
14021402

1403+
<indexterm zone="ddl-priv">
1404+
<primary>owner</primary>
1405+
</indexterm>
1406+
1407+
<indexterm zone="ddl-priv">
1408+
<primary>GRANT</primary>
1409+
</indexterm>
1410+
1411+
<indexterm zone="ddl-priv">
1412+
<primary>REVOKE</primary>
1413+
</indexterm>
1414+
14031415
<para>
1404-
When you create a database object, you become its owner. By
1405-
default, only the owner of an object can do anything with the
1406-
object. In order to allow other users to use it,
1407-
<firstterm>privileges</firstterm> must be granted. (However,
1408-
users that have the superuser attribute can always
1409-
access any object.)
1416+
When an object is created, it is assigned an owner. The
1417+
owner is normally the role that executed the creation statement.
1418+
For most kinds of objects, the initial state is that only the owner
1419+
(or a superuser) can do anything with the object. To allow
1420+
other roles to use it, <firstterm>privileges</firstterm> must be
1421+
granted.
1422+
There are several different kinds of privilege: <literal>SELECT</>,
1423+
<literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>,
1424+
<literal>TRUNCATE</>, <literal>REFERENCES</>, <literal>TRIGGER</>,
1425+
<literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>,
1426+
<literal>EXECUTE</>, and <literal>USAGE</>.
1427+
For more information on the different types of privileges supported by
1428+
<productname>PostgreSQL</productname>, see the
1429+
<xref linkend="sql-grant"> reference page.
14101430
</para>
14111431

14121432
<para>
@@ -1429,14 +1449,14 @@ ALTER TABLE products RENAME TO items;
14291449
the owner only.
14301450
</para>
14311451

1432-
<note>
1433-
<para>
1434-
To changetheowner of a table, index, sequence, or view, use the
1435-
<xreflinkend="sql-altertable">
1436-
command. Therearecorresponding <literal>ALTER</> commands for
1437-
other objecttypes.
1438-
</para>
1439-
</note>
1452+
<para>
1453+
An object can be assigned to a new owner with an <command>ALTER</command>
1454+
command oftheappropriate kind for the object, e.g. <xref
1455+
linkend="sql-altertable">. Superusers can always do
1456+
this; ordinary roles can only do it if theyareboth the current owner
1457+
of the object(or a member of the owning role) and a member of the new
1458+
owning role.
1459+
</para>
14401460

14411461
<para>
14421462
To assign privileges, the <command>GRANT</command> command is

‎doc/src/sgml/user-manag.sgml

Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- doc/src/sgml/user-manag.sgml -->
22

33
<chapter id="user-manag">
4-
<title>Database Roles and Privileges</title>
4+
<title>Database Roles</title>
55

66
<para>
77
<productname>PostgreSQL</productname> manages database access permissions
@@ -22,10 +22,9 @@
2222
</para>
2323

2424
<para>
25-
This chapter describes how to create and manage roles and introduces
26-
the privilege system. More information about the various types of
27-
database objects and the effects of privileges can be found in
28-
<xref linkend="ddl">.
25+
This chapter describes how to create and manage roles.
26+
More information about the effects of privileges on various database
27+
objects can be found in <xref linkend="ddl-priv">.
2928
</para>
3029

3130
<sect1 id="database-roles">
@@ -282,81 +281,6 @@ ALTER ROLE myname SET enable_indexscan TO off;
282281
</para>
283282
</sect1>
284283

285-
<sect1 id="privileges">
286-
<title>Privileges</title>
287-
288-
<indexterm zone="privileges">
289-
<primary>privilege</primary>
290-
</indexterm>
291-
292-
<indexterm zone="privileges">
293-
<primary>owner</primary>
294-
</indexterm>
295-
296-
<indexterm zone="privileges">
297-
<primary>GRANT</primary>
298-
</indexterm>
299-
300-
<indexterm zone="privileges">
301-
<primary>REVOKE</primary>
302-
</indexterm>
303-
304-
<para>
305-
When an object is created, it is assigned an owner. The
306-
owner is normally the role that executed the creation statement.
307-
For most kinds of objects, the initial state is that only the owner
308-
(or a superuser) can do anything with the object. To allow
309-
other roles to use it, <firstterm>privileges</firstterm> must be
310-
granted.
311-
There are several different kinds of privilege: <literal>SELECT</>,
312-
<literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>,
313-
<literal>TRUNCATE</>, <literal>REFERENCES</>, <literal>TRIGGER</>,
314-
<literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>,
315-
<literal>EXECUTE</>, and <literal>USAGE</>.
316-
For more information on the different types of privileges supported by
317-
<productname>PostgreSQL</productname>, see the
318-
<xref linkend="sql-grant"> reference page.
319-
</para>
320-
321-
<para>
322-
To assign privileges, the <command>GRANT</command> command is
323-
used. So, if <literal>joe</literal> is an existing role, and
324-
<literal>accounts</literal> is an existing table, the privilege to
325-
update the table can be granted with:
326-
<programlisting>
327-
GRANT UPDATE ON accounts TO joe;
328-
</programlisting>
329-
The special name <literal>PUBLIC</literal> can
330-
be used to grant a privilege to every role on the system. Writing
331-
<literal>ALL</literal> in place of a specific privilege specifies that all
332-
privileges that apply to the object will be granted.
333-
</para>
334-
335-
<para>
336-
To revoke a privilege, use the fittingly named
337-
<xref linkend="sql-revoke"> command:
338-
<programlisting>
339-
REVOKE ALL ON accounts FROM PUBLIC;
340-
</programlisting>
341-
</para>
342-
343-
<para>
344-
The special privileges of an object's owner (i.e., the right to modify
345-
or destroy the object) are always implicit in being the owner,
346-
and cannot be granted or revoked. But the owner can choose
347-
to revoke his own ordinary privileges, for example to make a
348-
table read-only for himself as well as others.
349-
</para>
350-
351-
<para>
352-
An object can be assigned to a new owner with an <command>ALTER</command>
353-
command of the appropriate kind for the object. Superusers can always do
354-
this; ordinary roles can only do it if they are both the current owner
355-
of the object (or a member of the owning role) and a member of the new
356-
owning role.
357-
</para>
358-
</sect1>
359-
360284
<sect1 id="role-membership">
361285
<title>Role Membership</title>
362286

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp