Re: ALTER TABLE ( smallinto -> boolean ) ...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TABLE ( smallinto -> boolean ) ...
Дата
Msg-id 15013.1125359379@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ALTER TABLE ( smallinto -> boolean ) ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Ответы Re: ALTER TABLE ( smallinto -> boolean ) ...  (Greg Stark <gsstark@mit.edu>)
Re: ALTER TABLE ( smallinto -> boolean ) ...  ("Marc G. Fournier" <scrappy@postgresql.org>)
Список pgsql-hackers
"Marc G. Fournier" <scrappy@postgresql.org> writes:
> # ALTER TABLE table ALTER COLUMN field1 type boolean;
> ERROR:  column "field1" cannot be cast to type "pg_catalog.bool"

> Should this not work?

No, because there's no built-in cast from smallint to bool.  You could
do something like

... type boolean using case when field1=0 then false else true end;
        regards, tom lane


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

Предыдущее
От: Rod Taylor
Дата:
Сообщение: Re: ALTER TABLE ( smallinto -> boolean ) ...
Следующее
От: Tom Lane
Дата:
Сообщение: SHMMAX seems entirely broken in OS X 10.4.2