Search Postgresql Archives

drop table if exists <VIEW_NAME>;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: drop table if exists <VIEW_NAME>;

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux