Re: cast bool/int

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: cast bool/int
Date: 2009-03-24 09:28:58
Message-ID: gqa94q$kv1$3@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2009-03-23, Zdravko Balorda <zdravko(dot)balorda(at)siix(dot)com> wrote:
>
> Hi,
> I need a casting operator from boolean to integer,

you can use any expression....

> tu put in ALTER TABLE statment after USING.
>
> Any ideas? Thanks.

CASE WHEN columname THEN 1 WHEN NOT columname THEN 0 ELSE NULL END

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2009-03-24 09:39:30 Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps
Previous Message Jasen Betts 2009-03-24 09:15:52 Re: alter table on a large db