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

Commit7c6df91

Browse files
committed
Second phase of committing Rod Taylor's pg_depend/pg_constraint patch.
pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEYconstraints all have real live entries in pg_constraint. pg_dependexists, and RESTRICT/CASCADE options work on most kinds of DROP;however, pg_depend is not yet very well populated with dependencies.(Most of the ones that are present at this point just replace formerlyhardwired associations, such as the implicit drop of a relation's pg_typeentry when the relation is dropped.) Need to add more logic to createdependency entries, improve pg_dump to dump constraints in place ofindexes and triggers, and add some regression tests.
1 parent791a40f commit7c6df91

File tree

77 files changed

+4067
-1980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4067
-1980
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 318 additions & 73 deletions
Large diffs are not rendered by default.

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.45 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.46 2002/07/12 18:43:12 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -39,7 +39,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
3939
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4040
ADD <replaceable class="PARAMETER">table_constraint_definition</replaceable>
4141
ALTER TABLE [ ONLY ] <replaceable class="PARAMETER">table</replaceable>
42-
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable>{ RESTRICT | CASCADE}
42+
DROP CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable>[ RESTRICT | CASCADE]
4343
ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
4444
OWNER TO <replaceable class="PARAMETER">new_owner</replaceable>
4545
</synopsis>
@@ -315,26 +315,6 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
315315
form after you've entered non-null values for the column in all rows.
316316
</para>
317317

318-
<para>
319-
In DROP CONSTRAINT, the RESTRICT keyword is required, although
320-
dependencies are not yet checked. The CASCADE option is unsupported.
321-
Currently DROP CONSTRAINT only handles CHECK constraints.
322-
To remove a PRIMARY or UNIQUE constraint, drop the
323-
relevant index using the <xref linkend="SQL-DROPINDEX" endterm="sql-dropindex-title"> command.
324-
To remove FOREIGN KEY constraints you need to recreate
325-
and reload the table, using other parameters to the
326-
<xref linkend="SQL-CREATETABLE" endterm="sql-createtable-title"> command.
327-
</para>
328-
<para>
329-
For example, to drop all constraints on a table <literal>distributors</literal>:
330-
<programlisting>
331-
CREATE TABLE temp AS SELECT * FROM distributors;
332-
DROP TABLE distributors;
333-
CREATE TABLE distributors AS SELECT * FROM temp;
334-
DROP TABLE temp;
335-
</programlisting>
336-
</para>
337-
338318
<para>
339319
Changing any part of the schema of a system
340320
catalog is not permitted.
@@ -395,7 +375,7 @@ ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5);
395375
<para>
396376
To remove a check constraint from a table and all its children:
397377
<programlisting>
398-
ALTER TABLE distributors DROP CONSTRAINT zipchk RESTRICT;
378+
ALTER TABLE distributors DROP CONSTRAINT zipchk;
399379
</programlisting>
400380
</para>
401381

‎doc/src/sgml/ref/comment.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.19 2002/05/13 17:45:30 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.20 2002/07/12 18:43:12 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -26,6 +26,7 @@ COMMENT ON
2626
TABLE <replaceable class="PARAMETER">object_name</replaceable> |
2727
COLUMN <replaceable class="PARAMETER">table_name</replaceable>.<replaceable class="PARAMETER">column_name</replaceable> |
2828
AGGREGATE <replaceable class="PARAMETER">agg_name</replaceable> (<replaceable class="PARAMETER">agg_type</replaceable>) |
29+
CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable> |
2930
DATABASE <replaceable class="PARAMETER">object_name</replaceable> |
3031
DOMAIN <replaceable class="PARAMETER">object_name</replaceable> |
3132
FUNCTION <replaceable class="PARAMETER">func_name</replaceable> (<replaceable class="PARAMETER">arg1_type</replaceable>, <replaceable class="PARAMETER">arg2_type</replaceable>, ...) |
@@ -52,7 +53,7 @@ COMMENT ON
5253
<variablelist>
5354
<varlistentry>
5455
<term><replaceable class="PARAMETER">object_name,
55-
table_name.column_name, agg_name, func_name, op, rule_name, trigger_name</replaceable></term>
56+
table_name.column_name, agg_name,constraint_name,func_name, op, rule_name, trigger_name</replaceable></term>
5657
<listitem>
5758
<para>
5859
The name of the object to be be commented. Names of tables,

‎doc/src/sgml/ref/drop_aggregate.sgml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.18 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.19 2002/07/12 18:43:12 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,7 +21,7 @@ PostgreSQL documentation
2121
<date>1999-07-20</date>
2222
</refsynopsisdivinfo>
2323
<synopsis>
24-
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">type</replaceable> )
24+
DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( <replaceable class="PARAMETER">type</replaceable> ) [ CASCADE | RESTRICT ]
2525
</synopsis>
2626

2727
<refsect2 id="R2-SQL-DROPAGGREGATE-1">
@@ -54,6 +54,23 @@ DROP AGGREGATE <replaceable class="PARAMETER">name</replaceable> ( <replaceable
5454
</para>
5555
</listitem>
5656
</varlistentry>
57+
<varlistentry>
58+
<term>CASCADE</term>
59+
<listitem>
60+
<para>
61+
Automatically drop objects that depend on the aggregate.
62+
</para>
63+
</listitem>
64+
</varlistentry>
65+
<varlistentry>
66+
<term>RESTRICT</term>
67+
<listitem>
68+
<para>
69+
Refuse to drop the aggregate if there are any dependent objects.
70+
This is the default.
71+
</para>
72+
</listitem>
73+
</varlistentry>
5774
</variablelist>
5875
</para>
5976
</refsect2>

‎doc/src/sgml/ref/drop_domain.sgml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_domain.sgml,v 1.6 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_domain.sgml,v 1.7 2002/07/12 18:43:13 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -48,8 +48,8 @@ DROP DOMAIN <replaceable class="PARAMETER">domainname</replaceable> [, ...] [ C
4848
<term><literal>CASCADE</></term>
4949
<listitem>
5050
<para>
51-
Automatically drop objects that depend on the domain. This
52-
behavior is not currently supported.
51+
Automatically drop objects that depend on the domain
52+
(such as table columns).
5353
</para>
5454
</listitem>
5555
</varlistentry>
@@ -58,7 +58,8 @@ DROP DOMAIN <replaceable class="PARAMETER">domainname</replaceable> [, ...] [ C
5858
<term><literal>RESTRICT</></term>
5959
<listitem>
6060
<para>
61-
Do not drop dependent objects. This is the default.
61+
Refuse to drop the domain if there are any dependent objects.
62+
This is the default.
6263
</para>
6364
</listitem>
6465
</varlistentry>
@@ -143,19 +144,14 @@ DROP DOMAIN box;
143144

144145
<refsect1 id="SQL-DROPDOMAIN-compatibility">
145146
<title>Compatibility</title>
147+
148+
<refsect2 id="R2-SQL-DROPDOMAIN-sql92">
149+
<title>
150+
SQL92
151+
</title>
146152

147-
<para>
148-
A <command>DROP DOMAIN</command> statement exists in SQL99. As with
149-
most other <quote>drop</quote> commands, <command>DROP
150-
DOMAIN</command> in SQL99 requires a <quote>drop behavior</quote>
151-
clause to select between dropping all dependent objects or refusing
152-
to drop if dependent objects exist:
153-
<synopsis>
154-
DROP DOMAIN <replaceable>name</replaceable> { CASCADE | RESTRICT }
155-
</synopsis>
156-
<productname>PostgreSQL</productname> accepts only the RESTRICT
157-
option, and currently does not check for existence of dependent objects.
158-
</para>
153+
<para></para>
154+
</refsect2>
159155
</refsect1>
160156

161157
<refsect1 id="SQL-DROPDOMAIN-see-also">

‎doc/src/sgml/ref/drop_function.sgml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.20 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.21 2002/07/12 18:43:13 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,7 +21,7 @@ PostgreSQL documentation
2121
<date>1999-07-20</date>
2222
</refsynopsisdivinfo>
2323
<synopsis>
24-
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] )
24+
DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) [ CASCADE | RESTRICT ]
2525
</synopsis>
2626

2727
<refsect2 id="R2-SQL-DROPFUNCTION-1">
@@ -49,6 +49,24 @@ DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable
4949
</para>
5050
</listitem>
5151
</varlistentry>
52+
<varlistentry>
53+
<term>CASCADE</term>
54+
<listitem>
55+
<para>
56+
Automatically drop objects that depend on the function
57+
(such as operators or triggers).
58+
</para>
59+
</listitem>
60+
</varlistentry>
61+
<varlistentry>
62+
<term>RESTRICT</term>
63+
<listitem>
64+
<para>
65+
Refuse to drop the function if there are any dependent objects.
66+
This is the default.
67+
</para>
68+
</listitem>
69+
</varlistentry>
5270
</variablelist>
5371
</para>
5472
</refsect2>
@@ -136,15 +154,8 @@ DROP FUNCTION sqrt(integer);
136154
<title>Compatibility</title>
137155

138156
<para>
139-
A <command>DROP FUNCTION</command> statement is defined in SQL99. One of its syntax forms is:
140-
141-
<synopsis>
142-
DROP FUNCTION <replaceable class="parameter">name</replaceable> (<replaceable>arg</>, ...) { RESTRICT | CASCADE }
143-
</synopsis>
144-
145-
where <literal>CASCADE</> specifies dropping all objects that
146-
depend on the function and <literal>RESTRICT</literal> refuses to
147-
drop the function if dependent objects exist.
157+
A <command>DROP FUNCTION</command> statement is defined in SQL99. One of
158+
its syntax forms is similar to PostgreSQL's.
148159
</para>
149160
</refsect1>
150161

‎doc/src/sgml/ref/drop_index.sgml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.15 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.16 2002/07/12 18:43:13 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,7 +21,7 @@ PostgreSQL documentation
2121
<date>1999-07-20</date>
2222
</refsynopsisdivinfo>
2323
<synopsis>
24-
DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> [, ...]
24+
DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> [, ...] [ CASCADE | RESTRICT ]
2525
</synopsis>
2626

2727
<refsect2 id="R2-SQL-DROPINDEX-1">
@@ -41,6 +41,23 @@ DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> [, ...]
4141
</para>
4242
</listitem>
4343
</varlistentry>
44+
<varlistentry>
45+
<term>CASCADE</term>
46+
<listitem>
47+
<para>
48+
Automatically drop objects that depend on the index.
49+
</para>
50+
</listitem>
51+
</varlistentry>
52+
<varlistentry>
53+
<term>RESTRICT</term>
54+
<listitem>
55+
<para>
56+
Refuse to drop the index if there are any dependent objects.
57+
This is the default.
58+
</para>
59+
</listitem>
60+
</varlistentry>
4461
</variablelist>
4562
</para>
4663
</refsect2>

‎doc/src/sgml/ref/drop_language.sgml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.14 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.15 2002/07/12 18:43:13 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,7 +21,7 @@ PostgreSQL documentation
2121
<date>1999-07-20</date>
2222
</refsynopsisdivinfo>
2323
<synopsis>
24-
DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable>
24+
DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable> [ CASCADE | RESTRICT ]
2525
</synopsis>
2626

2727
<refsect2 id="R2-SQL-DROPLANGUAGE-1">
@@ -43,7 +43,26 @@ DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable>
4343
</para>
4444
</listitem>
4545
</varlistentry>
46+
<varlistentry>
47+
<term>CASCADE</term>
48+
<listitem>
49+
<para>
50+
Automatically drop objects that depend on the language
51+
(such as functions in the language).
52+
</para>
53+
</listitem>
54+
</varlistentry>
55+
<varlistentry>
56+
<term>RESTRICT</term>
57+
<listitem>
58+
<para>
59+
Refuse to drop the language if there are any dependent objects.
60+
This is the default.
61+
</para>
62+
</listitem>
63+
</varlistentry>
4664
</variablelist>
65+
4766
</para>
4867
</refsect2>
4968

@@ -112,14 +131,6 @@ ERROR: Language "<replaceable class="parameter">name</replaceable>" doesn't exis
112131
<xref linkend="sql-createlanguage" endterm="sql-createlanguage-title">
113132
for information on how to create procedural languages.
114133
</para>
115-
116-
<para>
117-
No checks are made if functions or trigger procedures registered
118-
in this language still exist. To re-enable them without having
119-
to drop and recreate all the functions, the pg_proc's prolang
120-
attribute of the functions must be adjusted to the new object
121-
ID of the recreated pg_language entry for the PL.
122-
</para>
123134
</refsect2>
124135
</refsect1>
125136

‎doc/src/sgml/ref/drop_operator.sgml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_operator.sgml,v 1.16 2002/05/18 15:44:47 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_operator.sgml,v 1.17 2002/07/12 18:43:13 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -22,7 +22,7 @@ PostgreSQL documentation
2222
<date>1999-07-20</date>
2323
</refsynopsisdivinfo>
2424
<synopsis>
25-
DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">lefttype</replaceable> | NONE , <replaceable class="PARAMETER">righttype</replaceable> | NONE )
25+
DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable class="PARAMETER">lefttype</replaceable> | NONE , <replaceable class="PARAMETER">righttype</replaceable> | NONE ) [ CASCADE | RESTRICT ]
2626
</synopsis>
2727

2828
<refsect2 id="R2-SQL-DROPOPERATOR-1">
@@ -60,6 +60,23 @@ DROP OPERATOR <replaceable class="PARAMETER">id</replaceable> ( <replaceable cla
6060
</para>
6161
</listitem>
6262
</varlistentry>
63+
<varlistentry>
64+
<term>CASCADE</term>
65+
<listitem>
66+
<para>
67+
Automatically drop objects that depend on the operator.
68+
</para>
69+
</listitem>
70+
</varlistentry>
71+
<varlistentry>
72+
<term>RESTRICT</term>
73+
<listitem>
74+
<para>
75+
Refuse to drop the operator if there are any dependent objects.
76+
This is the default.
77+
</para>
78+
</listitem>
79+
</varlistentry>
6380
</variablelist>
6481
</para>
6582
</refsect2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp