pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nina Marlow <postgresql.2020@t-net.ruhr>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16492: DROP VIEW IF EXISTS error
Date: Mon, 15 Jun 2020 03:45:28 +0200
Message-ID: <124603462.20200615034528@smtp.mailbox.org> (raw)
In-Reply-To: <1050585.1592154735@sss.pgh.pa.us>
References: <16492-2f002961054fd4a8@postgresql.org>
	<CAKFQuwaCYa3Dx_dEcLfzUrUgcw_jOJ1Y_s-mGwkf0ENXt34XGg@mail.gmail.com>
	<CAFj8pRCe1+eAF1+06O_qCgVwrxAXsQkznqG1yTZSK+qnC29-Dw@mail.gmail.com>
	<187168644.20200613130633@smtp.mailbox.org>
	<CAFj8pRDyZb9Rt6Dst_9uf+A2r0e2iQRkoys7+JeR9E-voPDNnQ@mail.gmail.com>
	<CAKFQuwYkzKP17j1RS2ASL7oMnnbZW8qBb=kR3-e1Ug9QpnBvxw@mail.gmail.com>
	<1050585.1592154735@sss.pgh.pa.us>

> 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






view thread (17+ messages)  latest in thread

Message-ID: <124603462.20200615034528@smtp.mailbox.org>
Permalink:  ../124603462.20200615034528@smtp.mailbox.org/
Also on:    postgresql.org/message-id/124603462.20200615034528@smtp.mailbox.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: postgresql.2020@t-net.ruhr, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16492: DROP VIEW IF EXISTS error
  In-Reply-To: <124603462.20200615034528@smtp.mailbox.org>

* 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