Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTsvS-0005ki-DL for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 18:26:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gTsvR-0003yp-2m for pgsql-general@arkaria.postgresql.org; Mon, 03 Dec 2018 18:26:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTsvQ-0003yi-Ml for pgsql-general@lists.postgresql.org; Mon, 03 Dec 2018 18:26:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gTsvO-000770-7o for pgsql-general@postgresql.org; Mon, 03 Dec 2018 18:26:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wB3IQQfS002494; Mon, 3 Dec 2018 13:26:26 -0500 From: Tom Lane To: C GG cc: pgsql-general@postgresql.org Subject: Re: DROP CASCADE transitive dependencies In-reply-to: References: Comments: In-reply-to C GG message dated "Mon, 03 Dec 2018 13:13:00 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2492.1543861586.1@sss.pgh.pa.us> Date: Mon, 03 Dec 2018 13:26:26 -0500 Message-ID: <2493.1543861586@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk C GG 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