Re: BUG #16492: DROP VIEW IF EXISTS error - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #16492: DROP VIEW IF EXISTS error
Date
Msg-id CAKFQuwYd+QNZ=CzwvLssJyG-6QVZOjHcWW2Sb+cdVgK6D4-X5A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16492: DROP VIEW IF EXISTS error  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: BUG #16492: DROP VIEW IF EXISTS error  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-bugs
On Friday, June 12, 2020, Pavel Stehule <pavel.stehule@gmail.com> wrote:
DROP TABLE IF EXISTS xxx;
CREATE TABLE xxx;

If the first statement doesn't fail, then the second statement will be successful with very high priority. For me is little bit more intuitive message "cannot to drop some" then "cannot to create some" when first command is DROP, and I have to investigate, why DROP was ignored.

Fixing this bug you’d still get: Error: cannot create table xxx, view with same name already exists.  Do you seriously expect a user to then ask why the drop table command didn’t tell them about the view with the same name?

The create command should deal with namespace sharing, the drop command just should do what is written on the tin.  Especially since that is all it is documented to be concerned with.  As demonstrated actual use cases are broken with the current behavior which exists seemingly to only try and reduce user confusion.  I’d rather have the defined and expected behavior here and deal with confused people on the mailing list then tell people on their valid uses are not as important.

David J.

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #16492: DROP VIEW IF EXISTS error
Next
From: PG Bug reporting form
Date:
Subject: BUG #16493: posgresql has no entry in Volume Shadow Copy Service