From: Tom Lane <tgl@sss.pgh.pa.us>
To: C GG <cgg0007@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: DROP CASCADE transitive dependencies
Date: Mon, 03 Dec 2018 13:26:26 -0500
Message-ID: <2493.1543861586@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJXW-z8VKSb_+do3aNotDKA85ekmK_cg8UmctGEsP6MT11Pw0A@mail.gmail.com>
References: <CAJXW-z8VKSb_+do3aNotDKA85ekmK_cg8UmctGEsP6MT11Pw0A@mail.gmail.com>
C GG <cgg0007@gmail.com> writes:
> ...PostgreSQL 9.5...
> `DROP SCHEMA blah;` reports all the dependent objects and advises to `DROP
> SCHEMA blah CASCADE;` ...
> Will DROP ... CASCADE traverse the entire dependency tree for each of the
> dependent objects (potentially dropping something unintended), or will it
> stop at the first level and balk at any new transitive dependencies?
The former. However, the list of dependencies it's showing you as
potentially dropped already includes transitive dependencies; there
aren't going to be "new" ones unless somebody is adding things
concurrently.
If you're feeling paranoid, you could always do
begin;
drop ... cascade;
and then look at the reported list of objects before deciding whether
to commit or roll back.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, cgg0007@gmail.com
Subject: Re: DROP CASCADE transitive dependencies
In-Reply-To: <2493.1543861586@sss.pgh.pa.us>
References: <CAJXW-z8VKSb_+do3aNotDKA85ekmK_cg8UmctGEsP6MT11Pw0A@mail.gmail.com> <2493.1543861586@sss.pgh.pa.us>
* 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