Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYBzX-0000gc-G4 for pgsql-docs@arkaria.postgresql.org; Fri, 12 Aug 2016 12:55:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bYBzW-00064W-Qs for pgsql-docs@arkaria.postgresql.org; Fri, 12 Aug 2016 12:55:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYBzA-0005dl-JU for pgsql-docs@postgresql.org; Fri, 12 Aug 2016 12:54:52 +0000 Received: from fr1.2ndquadrant.fr ([2001:41d0:2:127c::1]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYBz7-0003JD-Ds for pgsql-docs@postgresql.org; Fri, 12 Aug 2016 12:54:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by fr1.2ndquadrant.fr (Postfix) with ESMTP id 2906E6080E; Fri, 12 Aug 2016 14:54:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at fr1.2ndquadrant.fr Received: from fr1.2ndquadrant.fr ([127.0.0.1]) by localhost (fr1.2ndquadrant.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pFQGTCGiRxWe; Fri, 12 Aug 2016 14:54:45 +0200 (CEST) Received: from [192.168.0.3] (ath91-3-88-167-161-184.fbx.proxad.net [88.167.161.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: charles) by fr1.2ndquadrant.fr (Postfix) with ESMTPSA id 9C3AE60161; Fri, 12 Aug 2016 14:54:45 +0200 (CEST) Subject: Re: Undocumented behavior od DROP SCHEMA ... CASCADE To: Peter Eisentraut , denisa.cirstescu@asentinel.com, pgsql-docs@postgresql.org References: <20160805104837.1412.84915@wrigleys.postgresql.org> From: Vik Fearing Message-ID: <7aeb5291-b9ca-3a3c-0bd8-e60b56ec2693@2ndquadrant.fr> Date: Fri, 12 Aug 2016 14:54:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org 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