In PostgreSQL when I run the command
x
DROP VIEW IF EXISTS view_name;
I get the response:
View IF dropped.
Can anyone explain what this means? why the word ‘IF
‘ instead of a response like: View view_name dropped
?
Advertisement
Answer
That’s not what PostgreSQL does. Demo:
postgres=# create view view_name as select 1;
CREATE VIEW
postgres=# drop view if exists view_name;
DROP VIEW
postgres=# echo :SERVER_VERSION_NUM
110002
postgres=# drop view if exists view_name;
NOTICE: view "view_name" does not exist, skipping
DROP VIEW
Possibly you’re not using PostgreSQL proper, but rather a fork that has a different syntax for this operation. Check out the result of SELECT version();
.