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

From: wei725(at)lycos(dot)com
To: Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to convert a binary filed to an integer field?
Date: 2010-08-30 15:27:06
Message-ID: 24138097.1201283182026430.JavaMail.root@mail-zbox11.bo3.lycos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Unfortunately, the statement doesn't work. I get an error message about unable to convert boolean to integer.

I have a look at the case statement for the conversion, but don't understand how it works.

----- Original Message -----
From: "Arjen Nienhuis" <a(dot)g(dot)nienhuis(at)gmail(dot)com>
To: wei725(at)lycos(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Sent: Thursday, August 26, 2010 4:56:09 AM GMT -08:00 US/Canada Pacific
Subject: Re: [GENERAL] How to convert a binary filed to an integer field?

On Wed, Aug 25, 2010 at 9:29 PM, < wei725(at)lycos(dot)com > wrote:

I have an application in the product. Now, one status field needs to have three statuses instead of two. How to make a such change in PostgreSQL?

ALTER TABLE product ALTER status TYPE int USING status::integer;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-08-30 16:08:38 Re: Question on trigger data visibility
Previous Message David Fetter 2010-08-30 14:29:42 Re: Restore referencial integrity