Re: BUG #16492: DROP VIEW IF EXISTS error

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: BUG #16492: DROP VIEW IF EXISTS error
Дата
Msg-id CAFj8pRCYpHMcFa2=EUyv8Zh6ENFXCyGHJ+qnsMDe4kvm2R9q_w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #16492: DROP VIEW IF EXISTS error  (Nina Marlow <postgresql.2020@t-net.ruhr>)
Ответы Re: BUG #16492: DROP VIEW IF EXISTS error  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs


po 15. 6. 2020 v 8:51 odesílatel Nina Marlow <postgresql.2020@t-net.ruhr> napsal:
> 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.

It is harder when you introduce schemas and search_path.

We know so in one schema there cannot be view and table with same name, but you can have more schemas on search_path

So the behaviour can be little bit different if you use qualified name 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



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #16494: cant use row['field name']
Следующее
От: Sandeep Thakkar
Дата:
Сообщение: Re: BUG #16460: Error when executing REFRESH MATERIALIZED VIEW WITH DATA;