ALTER TABLE documentation or parser bug

From: Flavio Henrique Araque Gurgel <fhagur(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: osalm(at)mirakl(dot)com
Subject: ALTER TABLE documentation or parser bug
Date: 2014-12-03 17:19:42
Message-ID: 547F462E.8090001@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-12-03 17:44:34 Re: ALTER TABLE documentation or parser bug
Previous Message Tom Lane 2014-12-03 16:18:30 Re: BUG #12126: Empty tsvector as output of to_tsvector function