| From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
|---|---|
| To: | wei725(at)lycos(dot)com |
| Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: How to convert a binary filed to an integer field? |
| Date: | 2010-08-26 21:38:07 |
| Message-ID: | AANLkTimLbGHC+mBRYjtWtb0tUCrkYCfy=ksLni4DQ8je@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thu, Aug 26, 2010 at 1:47 PM, <wei725(at)lycos(dot)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 such change in PostgreSQL. Since the application is in production already, do I need to create another field or convert the data 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | wei725 | 2010-08-26 21:41:30 | Re: How to convert a binary filed to an integer field? |
| Previous Message | Adrian von Bidder | 2010-08-26 19:30:12 | Re: Feature proposal |