Re: renameatt() can rename attribute of index, sequence, ...

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: renameatt() can rename attribute of index, sequence, ...
Дата
Msg-id 603c8f071003022126k3e172e9h82a9f1ab93b3d613@mail.gmail.com
обсуждение исходный текст
Ответ на renameatt() can rename attribute of index, sequence, ...  (KaiGai Kohei <kaigai@ak.jp.nec.com>)
Ответы Re: renameatt() can rename attribute of index, sequence, ...  (KaiGai Kohei <kaigai@ak.jp.nec.com>)
Список pgsql-hackers
2010/3/2 KaiGai Kohei <kaigai@ak.jp.nec.com>:
> Is it an expected behavior?
>
>  postgres=> CREATE SEQUENCE s;
>  CREATE SEQUENCE
>  postgres=> ALTER TABLE s RENAME sequence_name TO abcd;
>  ALTER TABLE
>
>  postgres=> CREATE TABLE t (a int primary key, b text);
>  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t_pkey" for table "t"
>  CREATE TABLE
>  postgres=> ALTER TABLE t_pkey RENAME a TO xyz;
>  ALTER TABLE
>
> The documentation says:
>  http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html
>
>    :
>  RENAME
>    The RENAME forms change the name of a table (or an index, sequence, or view) or
>    the name of an individual column in a table. There is no effect on the stored data.
>
> It seems to me the renameatt() should check relkind of the specified relation, and
> raise an error if relkind != RELKIND_RELATION.

Are we talking about renameatt() or RenameRelation()?  Letting
RenameRelation() rename whatever seems fairly harmless; renameatt(),
on the other hand, should probably refuse to allow this:

CREATE SEQUENCE foo;
ALTER TABLE foo RENAME COLUMN is_cycled TO bob;

...because that's just weird.  Tables, indexes, and views make sense,
but the attributes of a sequence should be nailed down I think;
they're basically system properties.

...Robert


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Avoiding bad prepared-statement plans.
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: [GENERAL] to_timestamp() and quarters