summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2016-08-12 22:45:18 +0000
committerTom Lane2016-08-12 22:45:18 +0000
commit499787819309293f3d2cd7219aee334a0e7d5069 (patch)
treea5dfc2f137d68cec7d957d14176b1f70cdbc4b1f
parent4b234fd8bf21cd6f5ff44f1f1c613bf40860998d (diff)
Doc: clarify that DROP ... CASCADE is recursive.
Apparently that's not obvious to everybody, so let's belabor the point. In passing, document that DROP POLICY has CASCADE/RESTRICT options (which it does, per gram.y) but they do nothing (I assume, anyway). Also update some long-obsolete commentary in gram.y. Discussion: <[email protected]>
-rw-r--r--doc/src/sgml/ddl.sgml23
-rw-r--r--doc/src/sgml/ref/alter_domain.sgml4
-rw-r--r--doc/src/sgml/ref/alter_foreign_table.sgml4
-rw-r--r--doc/src/sgml/ref/alter_table.sgml4
-rw-r--r--doc/src/sgml/ref/drop_access_method.sgml4
-rw-r--r--doc/src/sgml/ref/drop_aggregate.sgml5
-rw-r--r--doc/src/sgml/ref/drop_collation.sgml4
-rw-r--r--doc/src/sgml/ref/drop_domain.sgml4
-rw-r--r--doc/src/sgml/ref/drop_event_trigger.sgml4
-rw-r--r--doc/src/sgml/ref/drop_extension.sgml4
-rw-r--r--doc/src/sgml/ref/drop_foreign_data_wrapper.sgml6
-rw-r--r--doc/src/sgml/ref/drop_foreign_table.sgml3
-rw-r--r--doc/src/sgml/ref/drop_function.sgml4
-rw-r--r--doc/src/sgml/ref/drop_index.sgml4
-rw-r--r--doc/src/sgml/ref/drop_language.sgml4
-rw-r--r--doc/src/sgml/ref/drop_materialized_view.sgml4
-rw-r--r--doc/src/sgml/ref/drop_opclass.sgml4
-rw-r--r--doc/src/sgml/ref/drop_operator.sgml4
-rw-r--r--doc/src/sgml/ref/drop_opfamily.sgml4
-rw-r--r--doc/src/sgml/ref/drop_owned.sgml4
-rw-r--r--doc/src/sgml/ref/drop_policy.sgml14
-rw-r--r--doc/src/sgml/ref/drop_rule.sgml4
-rw-r--r--doc/src/sgml/ref/drop_schema.sgml13
-rw-r--r--doc/src/sgml/ref/drop_sequence.sgml4
-rw-r--r--doc/src/sgml/ref/drop_server.sgml4
-rw-r--r--doc/src/sgml/ref/drop_table.sgml4
-rw-r--r--doc/src/sgml/ref/drop_transform.sgml6
-rw-r--r--doc/src/sgml/ref/drop_trigger.sgml4
-rw-r--r--doc/src/sgml/ref/drop_tsconfig.sgml4
-rw-r--r--doc/src/sgml/ref/drop_tsdictionary.sgml4
-rw-r--r--doc/src/sgml/ref/drop_tsparser.sgml4
-rw-r--r--doc/src/sgml/ref/drop_tstemplate.sgml4
-rw-r--r--doc/src/sgml/ref/drop_type.sgml4
-rw-r--r--doc/src/sgml/ref/drop_view.sgml4
-rw-r--r--src/backend/parser/gram.y14
35 files changed, 144 insertions, 48 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 954c3a9b9e4..a393813b380 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -2611,7 +2611,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
if they are inherited
from any parent tables. If you wish to remove a table and all of its
descendants, one easy way is to drop the parent table with the
- <literal>CASCADE</literal> option.
+ <literal>CASCADE</literal> option (see <xref linkend="ddl-depend">).
</para>
<para>
@@ -3586,20 +3586,22 @@ HINT: Use DROP ... CASCADE to drop the dependent objects too.
<screen>
DROP TABLE products CASCADE;
</screen>
- and all the dependent objects will be removed. In this case, it
- doesn't remove the orders table, it only removes the foreign key
- constraint. (If you want to check what <command>DROP ... CASCADE</> will do,
+ and all the dependent objects will be removed, as will any objects
+ that depend on them, recursively. In this case, it doesn't remove
+ the orders table, it only removes the foreign key constraint.
+ It stops there because nothing depends on the foreign key constraint.
+ (If you want to check what <command>DROP ... CASCADE</> will do,
run <command>DROP</> without <literal>CASCADE</> and read the
<literal>DETAIL</> output.)
</para>
<para>
- All <command>DROP</> commands in <productname>PostgreSQL</> support
+ Almost all <command>DROP</> commands in <productname>PostgreSQL</> support
specifying <literal>CASCADE</literal>. Of course, the nature of
the possible dependencies varies with the type of the object. You
can also write <literal>RESTRICT</literal> instead of
<literal>CASCADE</literal> to get the default behavior, which is to
- prevent the dropping of objects that other objects depend on.
+ prevent dropping objects that any other objects depend on.
</para>
<note>
@@ -3614,6 +3616,15 @@ DROP TABLE products CASCADE;
</note>
<para>
+ If a <command>DROP</> command lists multiple
+ objects, <literal>CASCADE</literal> is only required when there are
+ dependencies outside the specified group. For example, when saying
+ <literal>DROP TABLE tab1, tab2</literal> the existence of a foreign
+ key referencing <literal>tab1</> from <literal>tab2</> would not mean
+ that <literal>CASCADE</literal> is needed to succeed.
+ </para>
+
+ <para>
For user-defined functions, <productname>PostgreSQL</productname> tracks
dependencies associated with a function's externally-visible properties,
such as its argument and result types, but <emphasis>not</> dependencies
diff --git a/doc/src/sgml/ref/alter_domain.sgml b/doc/src/sgml/ref/alter_domain.sgml
index ac9a5b3f87d..74dda73c699 100644
--- a/doc/src/sgml/ref/alter_domain.sgml
+++ b/doc/src/sgml/ref/alter_domain.sgml
@@ -212,7 +212,9 @@ ALTER DOMAIN <replaceable class="PARAMETER">name</replaceable>
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the constraint.
+ Automatically drop objects that depend on the constraint,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/alter_foreign_table.sgml b/doc/src/sgml/ref/alter_foreign_table.sgml
index 4329d43a1ed..b1692842b26 100644
--- a/doc/src/sgml/ref/alter_foreign_table.sgml
+++ b/doc/src/sgml/ref/alter_foreign_table.sgml
@@ -431,7 +431,9 @@ ALTER FOREIGN TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceab
<listitem>
<para>
Automatically drop objects that depend on the dropped column
- or constraint (for example, views referencing the column).
+ or constraint (for example, views referencing the column),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 5ca211e5f87..6f51cbc8962 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -823,7 +823,9 @@ ALTER TABLE ALL IN TABLESPACE <replaceable class="PARAMETER">name</replaceable>
<listitem>
<para>
Automatically drop objects that depend on the dropped column
- or constraint (for example, views referencing the column).
+ or constraint (for example, views referencing the column),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_access_method.sgml b/doc/src/sgml/ref/drop_access_method.sgml
index b899c71e1a3..8aa9197fe4a 100644
--- a/doc/src/sgml/ref/drop_access_method.sgml
+++ b/doc/src/sgml/ref/drop_access_method.sgml
@@ -62,7 +62,9 @@ DROP ACCESS METHOD [ IF EXISTS ] <replaceable class="parameter">name</replaceabl
<listitem>
<para>
Automatically drop objects that depend on the access method
- (such as operator classes, operator families, indexes).
+ (such as operator classes, operator families, and indexes),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_aggregate.sgml b/doc/src/sgml/ref/drop_aggregate.sgml
index 37683e51eff..c27c5eadf92 100644
--- a/doc/src/sgml/ref/drop_aggregate.sgml
+++ b/doc/src/sgml/ref/drop_aggregate.sgml
@@ -107,7 +107,10 @@ DROP AGGREGATE [ IF EXISTS ] <replaceable>name</replaceable> ( <replaceable>aggr
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the aggregate function.
+ Automatically drop objects that depend on the aggregate function
+ (such as views using it),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_collation.sgml b/doc/src/sgml/ref/drop_collation.sgml
index f00c88679b7..2177d8e5d65 100644
--- a/doc/src/sgml/ref/drop_collation.sgml
+++ b/doc/src/sgml/ref/drop_collation.sgml
@@ -60,7 +60,9 @@ DROP COLLATION [ IF EXISTS ] <replaceable>name</replaceable> [ CASCADE | RESTRIC
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the collation.
+ Automatically drop objects that depend on the collation,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_domain.sgml b/doc/src/sgml/ref/drop_domain.sgml
index 995d09ec8e9..e14795e6a30 100644
--- a/doc/src/sgml/ref/drop_domain.sgml
+++ b/doc/src/sgml/ref/drop_domain.sgml
@@ -62,7 +62,9 @@ DROP DOMAIN [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, .
<listitem>
<para>
Automatically drop objects that depend on the domain (such as
- table columns).
+ table columns),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_event_trigger.sgml b/doc/src/sgml/ref/drop_event_trigger.sgml
index cf42e150614..6e3ee22d7bb 100644
--- a/doc/src/sgml/ref/drop_event_trigger.sgml
+++ b/doc/src/sgml/ref/drop_event_trigger.sgml
@@ -63,7 +63,9 @@ DROP EVENT TRIGGER [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceabl
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the trigger.
+ Automatically drop objects that depend on the trigger,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_extension.sgml b/doc/src/sgml/ref/drop_extension.sgml
index 3bb9d9cb4cf..7438a08bb36 100644
--- a/doc/src/sgml/ref/drop_extension.sgml
+++ b/doc/src/sgml/ref/drop_extension.sgml
@@ -66,7 +66,9 @@ DROP EXTENSION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the extension.
+ Automatically drop objects that depend on the extension,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml b/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
index e43e0bda8b0..824d72c1766 100644
--- a/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
+++ b/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml
@@ -63,7 +63,9 @@ DROP FOREIGN DATA WRAPPER [ IF EXISTS ] <replaceable class="parameter">name</rep
<listitem>
<para>
Automatically drop objects that depend on the foreign-data
- wrapper (such as servers).
+ wrapper (such as foreign tables and servers),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
@@ -72,7 +74,7 @@ DROP FOREIGN DATA WRAPPER [ IF EXISTS ] <replaceable class="parameter">name</rep
<term><literal>RESTRICT</literal></term>
<listitem>
<para>
- Refuse to drop the foreign-data wrappers if any objects depend
+ Refuse to drop the foreign-data wrapper if any objects depend
on it. This is the default.
</para>
</listitem>
diff --git a/doc/src/sgml/ref/drop_foreign_table.sgml b/doc/src/sgml/ref/drop_foreign_table.sgml
index 3c6376413e7..f9d1e459d26 100644
--- a/doc/src/sgml/ref/drop_foreign_table.sgml
+++ b/doc/src/sgml/ref/drop_foreign_table.sgml
@@ -59,7 +59,8 @@ DROP FOREIGN TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceabl
<listitem>
<para>
Automatically drop objects that depend on the foreign table (such as
- views).
+ views), and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_function.sgml b/doc/src/sgml/ref/drop_function.sgml
index 51b8ede5fbf..5883d138115 100644
--- a/doc/src/sgml/ref/drop_function.sgml
+++ b/doc/src/sgml/ref/drop_function.sgml
@@ -107,7 +107,9 @@ DROP FUNCTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> (
<listitem>
<para>
Automatically drop objects that depend on the function (such as
- operators or triggers).
+ operators or triggers),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_index.sgml b/doc/src/sgml/ref/drop_index.sgml
index d66d30edf74..6fe108ded25 100644
--- a/doc/src/sgml/ref/drop_index.sgml
+++ b/doc/src/sgml/ref/drop_index.sgml
@@ -84,7 +84,9 @@ DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] <replaceable class="PARAMETER">name</r
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the index.
+ Automatically drop objects that depend on the index,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_language.sgml b/doc/src/sgml/ref/drop_language.sgml
index defae43c1a2..0facc628766 100644
--- a/doc/src/sgml/ref/drop_language.sgml
+++ b/doc/src/sgml/ref/drop_language.sgml
@@ -74,7 +74,9 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] <replaceable class="PARAMETER">name</
<listitem>
<para>
Automatically drop objects that depend on the language (such as
- functions in the language).
+ functions in the language),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_materialized_view.sgml b/doc/src/sgml/ref/drop_materialized_view.sgml
index f3ddfb06e8c..36ec33ceb08 100644
--- a/doc/src/sgml/ref/drop_materialized_view.sgml
+++ b/doc/src/sgml/ref/drop_materialized_view.sgml
@@ -64,7 +64,9 @@ DROP MATERIALIZED VIEW [ IF EXISTS ] <replaceable class="PARAMETER">name</replac
<listitem>
<para>
Automatically drop objects that depend on the materialized view (such as
- other materialized views, or regular views).
+ other materialized views, or regular views),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_opclass.sgml b/doc/src/sgml/ref/drop_opclass.sgml
index 2ee8f883b6c..187a9a4d1f7 100644
--- a/doc/src/sgml/ref/drop_opclass.sgml
+++ b/doc/src/sgml/ref/drop_opclass.sgml
@@ -78,7 +78,9 @@ DROP OPERATOR CLASS [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceab
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the operator class.
+ Automatically drop objects that depend on the operator class (such as
+ indexes), and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_operator.sgml b/doc/src/sgml/ref/drop_operator.sgml
index 902e4f3fa6a..13dd974f384 100644
--- a/doc/src/sgml/ref/drop_operator.sgml
+++ b/doc/src/sgml/ref/drop_operator.sgml
@@ -83,7 +83,9 @@ DROP OPERATOR [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> (
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the operator.
+ Automatically drop objects that depend on the operator (such as views
+ using it), and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_opfamily.sgml b/doc/src/sgml/ref/drop_opfamily.sgml
index d665e938833..53bce228837 100644
--- a/doc/src/sgml/ref/drop_opfamily.sgml
+++ b/doc/src/sgml/ref/drop_opfamily.sgml
@@ -79,7 +79,9 @@ DROP OPERATOR FAMILY [ IF EXISTS ] <replaceable class="PARAMETER">name</replacea
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the operator family.
+ Automatically drop objects that depend on the operator family,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_owned.sgml b/doc/src/sgml/ref/drop_owned.sgml
index d03cc578450..81694b88e53 100644
--- a/doc/src/sgml/ref/drop_owned.sgml
+++ b/doc/src/sgml/ref/drop_owned.sgml
@@ -55,7 +55,9 @@ DROP OWNED BY { <replaceable class="PARAMETER">name</replaceable> | CURRENT_USER
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the affected objects.
+ Automatically drop objects that depend on the affected objects,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_policy.sgml b/doc/src/sgml/ref/drop_policy.sgml
index e5eaaa785bb..69c87c0ade7 100644
--- a/doc/src/sgml/ref/drop_policy.sgml
+++ b/doc/src/sgml/ref/drop_policy.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-DROP POLICY [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable>
+DROP POLICY [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ON <replaceable class="parameter">table_name</replaceable> [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
@@ -72,6 +72,18 @@ DROP POLICY [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ON <
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><literal>CASCADE</literal></term>
+ <term><literal>RESTRICT</literal></term>
+
+ <listitem>
+ <para>
+ These key words do not have any effect, since there are no
+ dependencies on policies.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/doc/src/sgml/ref/drop_rule.sgml b/doc/src/sgml/ref/drop_rule.sgml
index 16ab2b1bb57..d4905a69c9d 100644
--- a/doc/src/sgml/ref/drop_rule.sgml
+++ b/doc/src/sgml/ref/drop_rule.sgml
@@ -71,7 +71,9 @@ DROP RULE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ON <re
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the rule.
+ Automatically drop objects that depend on the rule,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_schema.sgml b/doc/src/sgml/ref/drop_schema.sgml
index e3071227fe5..5b1697fff20 100644
--- a/doc/src/sgml/ref/drop_schema.sgml
+++ b/doc/src/sgml/ref/drop_schema.sgml
@@ -67,7 +67,9 @@ DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, .
<listitem>
<para>
Automatically drop objects (tables, functions, etc.) that are
- contained in the schema.
+ contained in the schema,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
@@ -85,6 +87,15 @@ DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, .
</refsect1>
<refsect1>
+ <title>Notes</title>
+
+ <para>
+ Using the <literal>CASCADE</literal> option might make the command
+ remove objects in other schemas besides the one(s) named.
+ </para>
+ </refsect1>
+
+ <refsect1>
<title>Examples</title>
<para>
diff --git a/doc/src/sgml/ref/drop_sequence.sgml b/doc/src/sgml/ref/drop_sequence.sgml
index b0f9cddda74..f0e1edc81c5 100644
--- a/doc/src/sgml/ref/drop_sequence.sgml
+++ b/doc/src/sgml/ref/drop_sequence.sgml
@@ -61,7 +61,9 @@ DROP SEQUENCE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [,
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the sequence.
+ Automatically drop objects that depend on the sequence,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_server.sgml b/doc/src/sgml/ref/drop_server.sgml
index 497d83fb4aa..f08dd7767df 100644
--- a/doc/src/sgml/ref/drop_server.sgml
+++ b/doc/src/sgml/ref/drop_server.sgml
@@ -63,7 +63,9 @@ DROP SERVER [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ CA
<listitem>
<para>
Automatically drop objects that depend on the server (such as
- user mappings).
+ user mappings),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_table.sgml b/doc/src/sgml/ref/drop_table.sgml
index 4cb1f49b3aa..94d28b06fbc 100644
--- a/doc/src/sgml/ref/drop_table.sgml
+++ b/doc/src/sgml/ref/drop_table.sgml
@@ -75,7 +75,9 @@ DROP TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ..
<listitem>
<para>
Automatically drop objects that depend on the table (such as
- views).
+ views),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_transform.sgml b/doc/src/sgml/ref/drop_transform.sgml
index 59ff87cfe48..698920a2266 100644
--- a/doc/src/sgml/ref/drop_transform.sgml
+++ b/doc/src/sgml/ref/drop_transform.sgml
@@ -18,7 +18,7 @@
<refsynopsisdiv>
<synopsis>
-DROP TRANSFORM [ IF EXISTS ] FOR <replaceable>type_name</replaceable> LANGUAGE <replaceable>lang_name</replaceable>
+DROP TRANSFORM [ IF EXISTS ] FOR <replaceable>type_name</replaceable> LANGUAGE <replaceable>lang_name</replaceable> [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
@@ -74,7 +74,9 @@ DROP TRANSFORM [ IF EXISTS ] FOR <replaceable>type_name</replaceable> LANGUAGE <
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the transform.
+ Automatically drop objects that depend on the transform,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_trigger.sgml b/doc/src/sgml/ref/drop_trigger.sgml
index 2067aefca24..d400b8383f4 100644
--- a/doc/src/sgml/ref/drop_trigger.sgml
+++ b/doc/src/sgml/ref/drop_trigger.sgml
@@ -73,7 +73,9 @@ DROP TRIGGER [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ON
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the trigger.
+ Automatically drop objects that depend on the trigger,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_tsconfig.sgml b/doc/src/sgml/ref/drop_tsconfig.sgml
index 831485e6a68..0096e0092d3 100644
--- a/doc/src/sgml/ref/drop_tsconfig.sgml
+++ b/doc/src/sgml/ref/drop_tsconfig.sgml
@@ -64,7 +64,9 @@ DROP TEXT SEARCH CONFIGURATION [ IF EXISTS ] <replaceable class="PARAMETER">name
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the text search configuration.
+ Automatically drop objects that depend on the text search configuration,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_tsdictionary.sgml b/doc/src/sgml/ref/drop_tsdictionary.sgml
index 44b30cbe676..803abf8cba9 100644
--- a/doc/src/sgml/ref/drop_tsdictionary.sgml
+++ b/doc/src/sgml/ref/drop_tsdictionary.sgml
@@ -64,7 +64,9 @@ DROP TEXT SEARCH DICTIONARY [ IF EXISTS ] <replaceable class="PARAMETER">name</r
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the text search dictionary.
+ Automatically drop objects that depend on the text search dictionary,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_tsparser.sgml b/doc/src/sgml/ref/drop_tsparser.sgml
index 789e807dbe2..fa997201610 100644
--- a/doc/src/sgml/ref/drop_tsparser.sgml
+++ b/doc/src/sgml/ref/drop_tsparser.sgml
@@ -62,7 +62,9 @@ DROP TEXT SEARCH PARSER [ IF EXISTS ] <replaceable class="PARAMETER">name</repla
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the text search parser.
+ Automatically drop objects that depend on the text search parser,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_tstemplate.sgml b/doc/src/sgml/ref/drop_tstemplate.sgml
index ebf81367441..9d051eb6197 100644
--- a/doc/src/sgml/ref/drop_tstemplate.sgml
+++ b/doc/src/sgml/ref/drop_tstemplate.sgml
@@ -63,7 +63,9 @@ DROP TEXT SEARCH TEMPLATE [ IF EXISTS ] <replaceable class="PARAMETER">name</rep
<term><literal>CASCADE</literal></term>
<listitem>
<para>
- Automatically drop objects that depend on the text search template.
+ Automatically drop objects that depend on the text search template,
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml
index 98c8a3cbef5..2c7b8fe9f6b 100644
--- a/doc/src/sgml/ref/drop_type.sgml
+++ b/doc/src/sgml/ref/drop_type.sgml
@@ -62,7 +62,9 @@ DROP TYPE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...
<listitem>
<para>
Automatically drop objects that depend on the type (such as
- table columns, functions, operators).
+ table columns, functions, and operators),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/drop_view.sgml b/doc/src/sgml/ref/drop_view.sgml
index 8b43be53600..40f23561884 100644
--- a/doc/src/sgml/ref/drop_view.sgml
+++ b/doc/src/sgml/ref/drop_view.sgml
@@ -62,7 +62,9 @@ DROP VIEW [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...
<listitem>
<para>
Automatically drop objects that depend on the view (such as
- other views).
+ other views),
+ and in turn all objects that depend on those objects
+ (see <xref linkend="ddl-depend">).
</para>
</listitem>
</varlistentry>
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 0cae44641f8..6a0f7b393cb 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -1126,9 +1126,9 @@ AlterUserSetStmt:
*
* Drop a postgresql DBMS role
*
- * XXX Ideally this would have CASCADE/RESTRICT options, but since a role
- * might own objects in multiple databases, there is presently no way to
- * implement either cascading or restricting. Caveat DBA.
+ * XXX Ideally this would have CASCADE/RESTRICT options, but a role
+ * might own objects in multiple databases, and there is presently no way to
+ * implement cascading to other databases. So we always behave as RESTRICT.
*****************************************************************************/
DropRoleStmt:
@@ -1152,9 +1152,7 @@ DropRoleStmt:
*
* Drop a postgresql DBMS user
*
- * XXX Ideally this would have CASCADE/RESTRICT options, but since a user
- * might own objects in multiple databases, there is presently no way to
- * implement either cascading or restricting. Caveat DBA.
+ * XXX As with DROP ROLE, no CASCADE/RESTRICT here.
*****************************************************************************/
DropUserStmt:
@@ -1220,7 +1218,7 @@ add_drop: ADD_P { $$ = +1; }
*
* Drop a postgresql group
*
- * XXX see above notes about cascading DROP USER; groups have same problem.
+ * XXX As with DROP ROLE, no CASCADE/RESTRICT here.
*****************************************************************************/
DropGroupStmt:
@@ -4574,6 +4572,8 @@ auth_ident: RoleSpec { $$ = $1; }
* QUERY :
* DROP USER MAPPING FOR auth_ident SERVER name
*
+ * XXX you'd think this should have a CASCADE/RESTRICT option, even if it's
+ * only pro forma; but the SQL standard doesn't show one.
****************************************************************************/
DropUserMappingStmt: DROP USER MAPPING FOR auth_ident SERVER name