From: | Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com> |
---|---|
To: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org, Zdravko Balorda <zdravko(dot)balorda(at)siix(dot)com> |
Subject: | Re: cast bool/int |
Date: | 2009-03-23 14:44:31 |
Message-ID: | 95f6bf9b0903230744r69a67a6dk89ba50f3f97603b1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
This:
SELECT true::integer, false::integer
also works on 8.1
--
regards
mk
2009/3/23 Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
> Στις 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
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
From | Date | Subject | |
---|---|---|---|
Next Message | Zdravko Balorda | 2009-03-23 14:45:04 | Re: cast bool/int |
Previous Message | Joshua Tolley | 2009-03-23 14:33:27 | Re: cast bool/int |