BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

Started by Maxim Bogukalmost 13 years ago6 messagesbugs
Jump to latest
#1Maxim Boguk
maxim.boguk@gmail.com

The following bug has been logged on the website:

Bug reference: 8176
Logged by: Maksym Boguk
Email address: maxim.boguk@gmail.com
PostgreSQL version: 9.2.4
Operating system: Any
Description:

Hi,

It seems that documentation wrong or [ CASCADE | RESTRICT ] feature of ALTER
TYPE ... RENAME TO isn't implemented.

Test case:

create type test as (qqq integer);
CREATE TYPE

alter type test rename to test1 RESTRICT;
ERROR: syntax error at or near "RESTRICT"
LINE 1: alter type test rename to test1 RESTRICT;
^

alter type test rename to test1 CASCADE;
ERROR: syntax error at or near "CASCADE"
LINE 1: alter type test rename to test1 CASCADE;
^

However:
[local]:5432 postgres@postgres=# alter type test rename to test1;
ALTER TYPE

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Stephen Frost
sfrost@snowman.net
In reply to: Maxim Boguk (#1)
Re: BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

Maxim,

* maxim.boguk@gmail.com (maxim.boguk@gmail.com) wrote:

It seems that documentation wrong or [ CASCADE | RESTRICT ] feature of ALTER
TYPE ... RENAME TO isn't implemented.

Actually, I'm pretty sure it's implemented but the grammar for it was
broken during refactoring to have all the ALTER .. RENAME operations go
through the same code paths.

Test case:

Thanks for this. I'm working on fixing this and will also add
regression tests to, hopefully, avoid this getting broken in the future.

Thanks again,

Stephen

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stephen Frost (#2)
Re: BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

Stephen Frost <sfrost@snowman.net> writes:

* maxim.boguk@gmail.com (maxim.boguk@gmail.com) wrote:

It seems that documentation wrong or [ CASCADE | RESTRICT ] feature of ALTER
TYPE ... RENAME TO isn't implemented.

Actually, I'm pretty sure it's implemented but the grammar for it was
broken during refactoring to have all the ALTER .. RENAME operations go
through the same code paths.

Are we sure the documentation's not wrong? A quick test says this
syntax isn't accepted in *any* existing release, and I can't say I
understand what it should do anyway.

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

#4Stephen Frost
sfrost@snowman.net
In reply to: Stephen Frost (#2)
Re: BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

Maxim,

* Stephen Frost (sfrost@snowman.net) wrote:

* maxim.boguk@gmail.com (maxim.boguk@gmail.com) wrote:

It seems that documentation wrong or [ CASCADE | RESTRICT ] feature of ALTER
TYPE ... RENAME TO isn't implemented.

Actually, I'm pretty sure it's implemented but the grammar for it was
broken during refactoring to have all the ALTER .. RENAME operations go
through the same code paths.

Nope, I was wrong- this looks to be a documentation bug, actually. The
documentation should be:

ALTER TYPE name RENAME ATTRIBUTE attribute_name TO new_attribute_name [ CASCADE | RESTRICT ]
ALTER TYPE name RENAME TO new_name

Which makes more sense (to me at least) anyway. Do you have a need for
this version:

ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]

or were you just playing with things..?

Thanks,

Stephen

#5Stephen Frost
sfrost@snowman.net
In reply to: Tom Lane (#3)
Re: BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

* Tom Lane (tgl@sss.pgh.pa.us) wrote:

Are we sure the documentation's not wrong? A quick test says this
syntax isn't accepted in *any* existing release, and I can't say I
understand what it should do anyway.

Was just composing an email to that effect, actually. I agree that it's
a documentation issue. Of course, that makes it easier to fix. :)

Thanks,

Stephen

#6Stephen Frost
sfrost@snowman.net
In reply to: Maxim Boguk (#1)
Re: BUG #8176: problem with the "ALTER TYPE name RENAME TO new_name [ CASCADE | RESTRICT ]" syntax

Maxim,

* maxim.boguk@gmail.com (maxim.boguk@gmail.com) wrote:

It seems that documentation wrong or [ CASCADE | RESTRICT ] feature of ALTER
TYPE ... RENAME TO isn't implemented.

I've updated the documentation to reflect that [ CASCADE | RESTRICT ] is
supported for ALTER TYPE .. RENAME ATTRIBUTE and that it isn't supported
for ALTER TYPE .. RENAME TO. This update will be pushed out with the
next releases.

Thanks!

Stephen