Hello all
In the documentation in:
http://www.postgresql.org/docs/current/static/sql-altertable.html
It says that, to rename a constraint, we can use:
ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ]
RENAME CONSTRAINT constraint_name TO new_constraint_name
With the optionel "IF EXISTS".
When trying in a 9.3.5 server:
ALTER TABLE IF EXISTS foo RENAME CONSTRAINT fk_foo_bar TO fk_foo_din;
It returns an error:
ERROR: syntax error at or near "CONSTRAINT"
LINE 1: ALTER TABLE IF EXISTS shop rename CONSTRAINT fk_foo_bar...
If I try without "IF EXISTS" it works as expected.
Who is wrong, parser or documentation (or myself)?
Thanks
Flavio Gurgel