Re: cast bool/int

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: Zdravko Balorda <zdravko(dot)balorda(at)siix(dot)com>
Subject: Re: cast bool/int
Date: 2009-03-23 08:18:31
Message-ID: 200903231018.32126.achill@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Στις Monday 23 March 2009 09:59:12 ο/η Zdravko Balorda έγραψε:
>
> Hi,
> I need a casting operator from boolean to integer,
> tu put in ALTER TABLE statment after USING.
>

Sorry in the above email i meant smth like
CASE WHEN column='t' THEN 1 ELSE 0 END

however
SELECT 't'::boolean::int;
int4
------
1
(1 row)

and
SELECT 'f'::boolean::int;
int4
------
0
(1 row)

work in 8.3

> Any ideas? Thanks.
>
> Zdravko
>
>

--
Achilleas Mantzios

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2009-03-23 14:05:02 Re: [SQL] bash & postgres
Previous Message Achilleas Mantzios 2009-03-23 08:15:11 Re: cast bool/int