drop table if exists ;

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема drop table if exists ;
Дата
Msg-id C4DAC901169B624F933534A26ED7DF310861B6B3@JENMAIL01.ad.intershop.net
обсуждение исходный текст
Ответы Re: drop table if exists ;  (Craig Ringer <ringerc@ringerc.id.au>)
Список pgsql-general

hello,

I've found a small logical issue while writing a migration script:

create table vtest (foo int);

create view vtest_v as select * from vtest;

drop table  if exists vtest_v;

ERROR:  "vtest_v" is not a table

drop view  if exists vtest;

ERROR:  "vtest" is not a view

this may be seen as a nice hint, but in my own opinion

DROP ... IF EXISTS should not throw an error for objects that do not exist.

A warning would be better here.

This would allow such a code to be error proof:

...

drop table if exists foo;

drop view  if exists foo;

...

best regards,

Marc Mamin

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

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: Index creation takes more time?
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: RFE: Column aliases in WHERE clauses