Re: How to convert a binary filed to an integer field?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: How to convert a binary filed to an integer field?
Дата
Msg-id AANLkTimLbGHC+mBRYjtWtb0tUCrkYCfy=ksLni4DQ8je@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to convert a binary filed to an integer field?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On Thu, Aug 26, 2010 at 1:47 PM,  <wei725@lycos.com> wrote:
> I know what I need to do in the application for the change. My problem is that I don't know a good process to make a
suchchange in PostgreSQL. Since the application is in production already, do I need to create another field or convert
thedata from the boolean field into the new field? 

recent versions of postgres allow you to do transformations w/alter table:

alter table foo alter bool_col type text using case when bool_col then
'foo' else 'bar' end;

expression can hook to a function if you want to do something really
complex (yes this is awesome) :-)

merlin

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

Предыдущее
От: Matthieu HUIN
Дата:
Сообщение: Re: Weird behavior with custom operators
Следующее
От: wei725@lycos.com
Дата:
Сообщение: Re: How to convert a binary filed to an integer field?