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

Commitcec3b0a

Browse files
committed
Implement DROP OWNED and REASSIGN OWNED. These new commands facilitate the
process of dropping roles by dropping objects owned by them and privilegesgranted to them, or giving the owned objects to someone else, through theuse of the data stored in the new pg_shdepend catalog.Some refactoring of the GRANT/REVOKE code was needed, as well as ALTER OWNERcode. Further cleanup of code duplication in the GRANT code seems necessary.Implemented by me after an idea from Tom Lane, who also provided various kindof implementation advice.Regression tests pass. Some tests for the new functionality are also added,as well as rudimentary documentation.
1 parentc52795d commitcec3b0a

31 files changed

+1532
-377
lines changed

‎doc/src/sgml/ref/allfiles.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.66 2005/07/29 15:13:11 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.67 2005/11/21 12:49:30 alvherre Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -70,6 +70,7 @@ Complete list of usable sgml source files in this directory.
7070
<!entity dropLanguage system "drop_language.sgml">
7171
<!entity dropOperator system "drop_operator.sgml">
7272
<!entity dropOperatorClass system "drop_opclass.sgml">
73+
<!entity dropOwned system "drop_owned.sgml">
7374
<!entity dropRole system "drop_role.sgml">
7475
<!entity dropRule system "drop_rule.sgml">
7576
<!entity dropSchema system "drop_schema.sgml">
@@ -93,6 +94,7 @@ Complete list of usable sgml source files in this directory.
9394
<!entity notify system "notify.sgml">
9495
<!entity prepare system "prepare.sgml">
9596
<!entity prepareTransaction system "prepare_transaction.sgml">
97+
<!entity reassignOwned system "reassign_owned.sgml">
9698
<!entity reindex system "reindex.sgml">
9799
<!entity releaseSavepoint system "release_savepoint.sgml">
98100
<!entity reset system "reset.sgml">

‎doc/src/sgml/ref/drop_owned.sgml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_owned.sgml,v 1.1 2005/11/21 12:49:30 alvherre Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-DROP-OWNED">
7+
<refmeta>
8+
<refentrytitle id="SQL-DROP-OWNED-TITLE">DROP OWNED</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>DROP OWNED</refname>
14+
<refpurpose>remove database objects owned by a database role</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-drop-owned">
18+
<primary>DROP OWNED</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
DROP OWNED <replaceable class="PARAMETER">name</replaceable> [, ...] [ RESTRICT | CASCADE ]
24+
</synopsis>
25+
</refsynopsisdiv>
26+
27+
<refsect1>
28+
<title>Description</title>
29+
30+
<para>
31+
The <command>DROP OWNED</command> instructs the system to drop those
32+
database objects owned by one of the given roles which reside on the
33+
current database. All privileges granted to the given roles will also be
34+
revoked.
35+
</para>
36+
37+
<para>
38+
If <literal>CASCADE</> is specified, <command>DROP OWNED</command>
39+
will behave like a <command>DROP ... CASCADE</command> was issued
40+
for each object, that is, objects dependent on the ones owned by the
41+
given users will be dropped as well.
42+
</para>
43+
</refsect1>
44+
45+
<refsect1>
46+
<title>Notes</title>
47+
<para>
48+
The <command>DROP OWNED</command> command is mostly used in preparation to
49+
drop the roles. It may be necessary to issue the command in more than one
50+
database.
51+
</para>
52+
53+
<para>
54+
Using the <literal>CASCADE</literal> option may make the command recurse to
55+
objects owned by other users.
56+
</para>
57+
58+
<para>
59+
See the <command>REASSIGN OWNED</command> command for an alternative that
60+
gives the objects away to another role.
61+
</para>
62+
</refsect1>
63+
64+
<refsect1>
65+
<title>Compatibility</title>
66+
67+
<para>
68+
The <command>DROP OWNED</command> statement is a
69+
<productname>PostgreSQL</productname> extension.
70+
</para>
71+
</refsect1>
72+
73+
<refsect1>
74+
<title>See Also</title>
75+
76+
<simplelist type="inline">
77+
<member><xref linkend="sql-reassign-owned" endterm="sql-reassign-owned-title"></member>
78+
<member><xref linkend="sql-droprole" endterm="sql-droprole-title"></member>
79+
</simplelist>
80+
</refsect1>
81+
82+
</refentry>
83+
84+
<!-- Keep this comment at the end of the file
85+
Local variables:
86+
mode: sgml
87+
sgml-omittag:nil
88+
sgml-shorttag:t
89+
sgml-minimize-attributes:nil
90+
sgml-always-quote-attributes:t
91+
sgml-indent-step:1
92+
sgml-indent-data:t
93+
sgml-parent-document:nil
94+
sgml-default-dtd-file:"../reference.ced"
95+
sgml-exposed-tags:nil
96+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
97+
sgml-local-ecat-files:nil
98+
End:
99+
-->

‎doc/src/sgml/ref/reassign_owned.sgml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!--
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.1 2005/11/21 12:49:30 alvherre Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-REASSIGN-OWNED">
7+
<refmeta>
8+
<refentrytitle id="SQL-REASSIGN-OWNED-TITLE">REASSIGN OWNED</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>REASSIGN OWNED</refname>
14+
<refpurpose>change ownership of database objects owned by a database role</refpurpose>
15+
</refnamediv>
16+
17+
<indexterm zone="sql-reassign-owned">
18+
<primary>REASSIGN OWNED</primary>
19+
</indexterm>
20+
21+
<refsynopsisdiv>
22+
<synopsis>
23+
REASSIGN OWNED <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
24+
</synopsis>
25+
</refsynopsisdiv>
26+
27+
<refsect1>
28+
<title>Description</title>
29+
30+
<para>
31+
The <command>REASSIGN OWNED</command> instructs the system to change
32+
the ownership of the database objects owned by one of the old_roles,
33+
to new_role.
34+
</para>
35+
</refsect1>
36+
37+
<refsect1>
38+
<title>Notes</title>
39+
40+
<para>
41+
The <command>REASSIGN OWNED</command> command is mostly used in preparation to
42+
drop the roles. See the <command>DROP OWNED</command> command for an
43+
alternative that drops the objects.
44+
</para>
45+
46+
<para>
47+
The <command>REASSIGN OWNED</command> command does not affect the privileges
48+
granted to the old_roles in objects not owned by them. Use
49+
<command>DROP OWNED</command> to remove them.
50+
</para>
51+
52+
</refsect1>
53+
54+
<refsect1>
55+
<title>Compatibility</title>
56+
57+
<para>
58+
The <command>REASSIGN OWNED</command> statement is a
59+
<productname>PostgreSQL</productname> extension.
60+
</para>
61+
</refsect1>
62+
63+
<refsect1>
64+
<title>See Also</title>
65+
66+
<simplelist type="inline">
67+
<member><xref linkend="sql-drop-owned" endterm="sql-drop-owned-title"></member>
68+
<member><xref linkend="sql-droprole" endterm="sql-droprole-title"></member>
69+
</simplelist>
70+
</refsect1>
71+
72+
</refentry>
73+
74+
<!-- Keep this comment at the end of the file
75+
Local variables:
76+
mode: sgml
77+
sgml-omittag:nil
78+
sgml-shorttag:t
79+
sgml-minimize-attributes:nil
80+
sgml-always-quote-attributes:t
81+
sgml-indent-step:1
82+
sgml-indent-data:t
83+
sgml-parent-document:nil
84+
sgml-default-dtd-file:"../reference.ced"
85+
sgml-exposed-tags:nil
86+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
87+
sgml-local-ecat-files:nil
88+
End:
89+
-->

‎doc/src/sgml/reference.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- reference.sgml
2-
$PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.56 2005/07/29 15:13:11 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.57 2005/11/21 12:49:30 alvherre Exp $
33

44
PostgreSQL Reference Manual
55
-->
@@ -102,6 +102,7 @@ PostgreSQL Reference Manual
102102
&dropLanguage;
103103
&dropOperator;
104104
&dropOperatorClass;
105+
&dropOwned;
105106
&dropRole;
106107
&dropRule;
107108
&dropSchema;
@@ -125,6 +126,7 @@ PostgreSQL Reference Manual
125126
&notify;
126127
&prepare;
127128
&prepareTransaction;
129+
&reassignOwned;
128130
&reindex;
129131
&releaseSavepoint;
130132
&reset;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp