Re: BUG #16492: DROP VIEW IF EXISTS error

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #16492: DROP VIEW IF EXISTS error
Дата
Msg-id CAKFQuwaCYa3Dx_dEcLfzUrUgcw_jOJ1Y_s-mGwkf0ENXt34XGg@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #16492: DROP VIEW IF EXISTS error  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #16492: DROP VIEW IF EXISTS error  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-bugs
On Friday, June 12, 2020, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      16492
Logged by:          Nina Marlow
Email address:      postgresql.2020@t-net.ruhr
PostgreSQL version: 12.3
Operating system:   Linux/Docker
Description:       

When trying to use "DROP VIEW IF EXISTS x" while a table named "x" exists,
the DROP statement raises an "Error: x is not a view".

The documentation says about the "IF EXISTS" clause:

> Do not throw an error if the view does not exist. A notice is issued in
this case.

Imho, there shouldn't be an error if the view does not exist regardless of
whether or not a table with this name exists. The observed behavior is
contrary to the sense of the "IF EXISTS" clause as one would have to check
whether a table with the desired name exists before using "DROP VIEW IF
EXISTS". But then you could directly check whether or not the view itself
exists.

This thread from 2018 illustrates the current state of the discussion:


I still concur this is indeed a bug that should be fixed.

David J.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #16040: PL/PGSQL RETURN QUERY statement never uses a parallel plan
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #16492: DROP VIEW IF EXISTS error