Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkixT-00079C-8f for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jun 2020 06:51:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jkixQ-0005gu-V3 for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jun 2020 06:51:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkeOq-0005lP-Ie for pgsql-bugs@lists.postgresql.org; Mon, 15 Jun 2020 01:59:00 +0000 Received: from mout-p-101.mailbox.org ([80.241.56.151]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.92) (envelope-from ) id 1jkeOn-0004NC-VK for pgsql-bugs@lists.postgresql.org; Mon, 15 Jun 2020 01:58:59 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 49lZHy1KmBzKmhk for ; Mon, 15 Jun 2020 03:58:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id 6AqCeMJGQ6Vl for ; Mon, 15 Jun 2020 03:58:51 +0200 (CEST) Date: Mon, 15 Jun 2020 03:45:28 +0200 From: Nina Marlow Message-ID: <124603462.20200615034528@smtp.mailbox.org> To: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16492: DROP VIEW IF EXISTS error In-Reply-To: <1050585.1592154735@sss.pgh.pa.us> References: <16492-2f002961054fd4a8@postgresql.org> <187168644.20200613130633@smtp.mailbox.org> <1050585.1592154735@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2915D173D X-Rspamd-Score: -1.53 / 15.00 / 15.00 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > the most likely effect of such a change is that we fix no scripts, while > breaking any scripts that were dependent on the existing behavior. As the documentation seems to always have said that "IF EXISTS" doesn't raise an error, there's no script that could get broken. On the other side, currently I currently don't see a way of dropping a view or table without knowing its exact type. So to drop a *view*, I need to be sure that there is no *table* with the same name. I have to check that first before using DROP. But that makes IF EXISTS more or less useless because I might just as well check whether the view exists and depending on the result either do a DROP or not. > What I'd prefer to see, I think, is a command DROP RELATION [IF EXISTS] If the already implemented DROPs behaved as documented, you'd not need an additional third statement. It'd be just identical to DROP TABLE IF EXISTS DROP VIEW IF EXISTS