Re: Undocumented behavior od DROP SCHEMA ... CASCADE

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, 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 22:26:11
Message-ID: 20160812222611.GA721702@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Tom Lane wrote:

> > also, object locks need to be acquired, which
> > can be very troublesome if you discover that some frequently-used object
> > is in the set to be dropped, by some unfortunate accident.
>
> You'd need the object locks in any case, to be sure things hold still long
> enough for their dependencies to be examined. It's possible a weaker lock
> type would suffice, but I'm not sure; we generally don't require exclusive
> lock on an object to add or remove dependencies on it.

Of course, using a weak lock could run afoul of somebody changing the
dependencies underneath. But even using a stronger lock is unlikely to
give any actual protection: in UI programs (be it GUI admin programs or
psql), more likely than not many users are going to run a check in one
transaction, then run the actual drop in a different transaction.

> I'm not necessarily against adding a function to report the dependencies
> as a table rather than NOTICE output. But things have been like this
> for quite a few years and I can count the number of requests for such a
> function without running out of thumbs. Doesn't seem very high priority.

Sure. Perhaps this'd be a good item for a novice hacker.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Alvaro Herrera 2016-08-12 22:28:36 Re: Undocumented behavior od DROP SCHEMA ... CASCADE
Previous Message David G. Johnston 2016-08-12 22:18:26 Re: Undocumented behavior od DROP SCHEMA ... CASCADE