Re: Attribute has wrong type in ALTER TABLE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Attribute has wrong type in ALTER TABLE
Дата
Msg-id 518.1563991343@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Attribute has wrong type in ALTER TABLE  (Manuel Rigger <rigger.manuel@gmail.com>)
Ответы Re: Attribute has wrong type in ALTER TABLE  (Manuel Rigger <rigger.manuel@gmail.com>)
Список pgsql-bugs
Manuel Rigger <rigger.manuel@gmail.com> writes:
> the statements below result in an error "ERROR:  attribute 1 of type
> t0 has wrong type":

> CREATE TABLE t0(c0 VARCHAR(10));
> INSERT INTO t0(c0) VALUES('');
> ALTER TABLE t0 ALTER c0 SET DATA TYPE TEXT, ADD EXCLUDE (('a' LIKE
> t0.c0) WITH =); -- unexpected: ERROR:  attribute 1 of type t0 has
> wrong type

Yeah, this is another variant of the problems with doing
transformIndexStmt too early, like your previous report
https://www.postgresql.org/message-id/CA%2Bu7OA4hkFSV_Y%3DsW_vNcYgKFEoq0WL5GtrBWEHUZnCqSqjhAA%40mail.gmail.com
The index expression is parse-analyzed while c0 is still varchar,
and then it's wrong by the time we go to create the index.

We need to fix things so that ALTER TABLE doesn't do any of that
work until after it's finished with ALTER COLUMN TYPE subcommands.

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15922: Simple select with multiple exists filters returns duplicates from a primary key field
Следующее
От: David Raymond
Дата:
Сообщение: RE: BUG #15922: Simple select with multiple exists filters returnsduplicates from a primary key field