Re: Undocumented behavior od DROP SCHEMA ... CASCADE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Vik Fearing <vik(at)2ndquadrant(dot)fr>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, denisa(dot)cirstescu(at)asentinel(dot)com, "pgsql-docs(at)postgresql(dot)org" <pgsql-docs(at)postgresql(dot)org>
Subject: Re: Undocumented behavior od DROP SCHEMA ... CASCADE
Date: 2016-08-12 14:01:44
Message-ID: 25576.1471010504@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Fri, Aug 12, 2016 at 8:54 AM, Vik Fearing <vik(at)2ndquadrant(dot)fr> wrote:
>> 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.

> Yeah, it should probably be modified to something like:

> Automatically drop objects (tables, functions, etc...) that are contained
> in the schema. Each object dropped is also done with the CASCADE option.
> This means that others schemas will be affected if they depend on objects
> in the named schema.

If we're going to add a warning about CASCADE being recursive, it would
logically need to be added to every last DROP command that has a CASCADE
option, which is most of them. I don't necessarily object to that, but
we'd need a more boiler-plate, copy-and-pasteable phrasing.

A quick survey says that DROP SCHEMA is just about the only such command
that isn't documented with wording along the lines of "Automatically drop
objects that depend on the <whatever>", often with a parenthetical "such
as" to illustrate what sorts of objects might be dependent. I think the
variant wording for DROP SCHEMA was intentional, with the thought that it
was easy to specify exactly which objects "depend on" a schema --- but is
that decision contributing to the confusion?

I'm inclined to suggest that maybe the generic phrasing could be
"Automatically drop objects that depend on the <whatever> [(such as ...)],
and in turn all objects that depend on those objects".

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2016-08-12 14:24:13 Re: Wording in TABLESAMPLE documentation
Previous Message David G. Johnston 2016-08-12 13:16:22 Re: Undocumented behavior od DROP SCHEMA ... CASCADE