Re: Changing boolean to a smallint

Поиск
Список
Период
Сортировка
От Dean Gibson (DB Administrator)
Тема Re: Changing boolean to a smallint
Дата
Msg-id 4CD3448D.60208@ultimeth.com
обсуждение исходный текст
Ответ на Changing boolean to a smallint  (Christine Penner <chris@fp2.ca>)
Ответы Re: Changing boolean to a smallint  ("Dean Gibson (DB Administrator)" <postgresql@ultimeth.com>)
Список pgsql-general
On 2010-11-04 15:41, Christine Penner wrote:
> I have a table column I want to change from a boolean to a smallint.
> changing false to 0 and true to 1. How do I do that?
>
> Christine Penner
> Ingenious Software
> 250-352-9495
> chris@fp2.ca

ALTER TABLE ALTER col_name TYPE SMALLINT
   USING CASE WHEN col_name THEN 1 ELSE 0 END;

--
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.


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

Предыдущее
От: Christine Penner
Дата:
Сообщение: Changing boolean to a smallint
Следующее
От: "Dean Gibson (DB Administrator)"
Дата:
Сообщение: Re: Changing boolean to a smallint