Re: Unexpected behavior of DROP VIEW/TABLE IF EXISTS

Поиск
Список
Период
Сортировка
От Peter Moser
Тема Re: Unexpected behavior of DROP VIEW/TABLE IF EXISTS
Дата
Msg-id a3d63a69-d827-ff77-b934-1271f3f6fb37@gmail.com
обсуждение исходный текст
Ответ на Re: Unexpected behavior of DROP VIEW/TABLE IF EXISTS  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On 06/26/2018 05:34 PM, Pavel Stehule wrote:
> 2018-06-26 17:23 GMT+02:00 Peter Moser <pitiz29a@gmail.com 
> <mailto:pitiz29a@gmail.com>>:
>     What do you think, is it worth to create a patch to solve this
>     issue, where a DROP TABLE does not fail, if the given name is
>     actually a VIEW or vice-versa?
> 
> 
> DROP TABLE should to remove table and nothing else, like DROP VIEW 
> should to drop just view and nothing else. It is safeguard.

My last sentence is misleading. What I thought is:

DROP TABLE X;

Should not delete a view X, and result in an error only if table X does 
not exist. It should not look at views for error handling, maybe just as 
hint that there is a view X and we might use DROP VIEW X instead.

DROP TABLE IF EXISTS X;

Should also not delete a view X, and not result in any error if X is a 
view and not a table.

Hopefully I explained things better now.

Cheers,
Peter


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Unexpected behavior of DROP VIEW/TABLE IF EXISTS
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ssl_library parameter