From: Vik Fearing <vik@2ndquadrant.fr>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: denisa.cirstescu@asentinel.com
To: pgsql-docs@postgresql.org
Subject: Re: Undocumented behavior od DROP SCHEMA ... CASCADE
Date: Fri, 12 Aug 2016 14:54:44 +0200
Message-ID: <7aeb5291-b9ca-3a3c-0bd8-e60b56ec2693@2ndquadrant.fr> (raw)
In-Reply-To: <fbb1360b-e450-aaf6-19bd-9bfcffb35ed7@2ndquadrant.com>
References: <20160805104837.1412.84915@wrigleys.postgresql.org>
<fbb1360b-e450-aaf6-19bd-9bfcffb35ed7@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>
On 12/08/16 14:47, Peter Eisentraut wrote:
> On 8/5/16 6:48 AM, denisa.cirstescu@asentinel.com wrote:
>> Page: https://www.postgresql.org/docs/9.5/static/sql-dropschema.html
>> Description:
>>
>> DROP SCHEMA ... CASCADE has a behavior that has not been documented.
>> According to the documentation: "CASCADE - Automatically drop objects
>> (tables, functions, etc.) that are contained in the schema.".
>> Well, besides this, DROP SCHEMA ... CASCADE also drops all the views which
>> depends on the schema that is being dropped. It does not matter if the views
>> are in the public schema or another schema than the one being dropped, they
>> are deleted.
>
> Can you give an example?
vik=# create schema a create table t (id int);
CREATE SCHEMA
vik=# create schema b create view v as select * from a.t;
CREATE SCHEMA
vik=# drop schema a cascade;
NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to table a.t
drop cascades to view b.v
DROP SCHEMA
I think the OP is complaining that cascading to b.v is not sufficiently
documented. It seems logical to me that this would be the correct
behavior, but since at least one person got confused enough about it to
come and tell us, we should probably add some kind of warning or something.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: vik@2ndquadrant.fr, peter.eisentraut@2ndquadrant.com, denisa.cirstescu@asentinel.com
Subject: Re: Undocumented behavior od DROP SCHEMA ... CASCADE
In-Reply-To: <7aeb5291-b9ca-3a3c-0bd8-e60b56ec2693@2ndquadrant.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox