ALTER TABLE documentation or parser bug
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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Flavio Henrique Araque Gurgel <fhagur@gmail.com> writes:
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
Who is wrong, parser or documentation (or myself)?
Documentation, evidently: a look at the grammar shows that IF EXISTS has
been implemented only for a rather haphazard subset of ALTER ... RENAME
cases, and this isn't one of them.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Wed, Dec 3, 2014 at 12:44:34PM -0500, Tom Lane wrote:
Flavio Henrique Araque Gurgel <fhagur@gmail.com> writes:
Hello all
In the documentation in:
http://www.postgresql.org/docs/current/static/sql-altertable.htmlIt says that, to rename a constraint, we can use:
ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ]
RENAME CONSTRAINT constraint_name TO new_constraint_nameWho is wrong, parser or documentation (or myself)?
Documentation, evidently: a look at the grammar shows that IF EXISTS has
been implemented only for a rather haphazard subset of ALTER ... RENAME
cases, and this isn't one of them.
Rather than fixing the docs, I implemented the feature --- patch
attached.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
Attachments:
alter.difftext/x-diff; charset=us-asciiDownload+20-2
On Sat, Mar 21, 2015 at 10:52 AM, Bruce Momjian <bruce@momjian.us> wrote:
Rather than fixing the docs, I implemented the feature --- patch
attached.
A regression test would be welcome, in alter_table for example.
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Sat, Mar 21, 2015 at 04:27:45PM +0900, Michael Paquier wrote:
On Sat, Mar 21, 2015 at 10:52 AM, Bruce Momjian <bruce@momjian.us> wrote:
Rather than fixing the docs, I implemented the feature --- patch
attached.A regression test would be welcome, in alter_table for example.
OK, regression test added in the attached patch.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
Attachments:
alter.difftext/x-diff; charset=us-asciiDownload+23-2
On Sun, Mar 22, 2015 at 10:17 AM, Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Mar 21, 2015 at 04:27:45PM +0900, Michael Paquier wrote:
On Sat, Mar 21, 2015 at 10:52 AM, Bruce Momjian <bruce@momjian.us> wrote:
Rather than fixing the docs, I implemented the feature --- patch
attached.A regression test would be welcome, in alter_table for example.
OK, regression test added in the attached patch.
That looks fine for me. Thanks!
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Sun, Mar 22, 2015 at 02:45:32PM +0900, Michael Paquier wrote:
On Sun, Mar 22, 2015 at 10:17 AM, Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Mar 21, 2015 at 04:27:45PM +0900, Michael Paquier wrote:
On Sat, Mar 21, 2015 at 10:52 AM, Bruce Momjian <bruce@momjian.us> wrote:
Rather than fixing the docs, I implemented the feature --- patch
attached.A regression test would be welcome, in alter_table for example.
OK, regression test added in the attached patch.
That looks fine for me. Thanks!
Thanks, applied.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs