Re: cast bool/int - Mailing list pgsql-sql

From Zdravko Balorda
Subject Re: cast bool/int
Date
Msg-id 49C7A070.6070600@siix.com
Whole thread Raw
In response to Re: cast bool/int  (Joshua Tolley <eggyknap@gmail.com>)
List pgsql-sql
>> CASE WHEN column='t' THEN 1 ELSE 0 END
> 
> Or just CASE WHEN column THEN 1 ELSE 0 END.

In the mean time I've got an elegant solution:

alter ... ... column TYPE smallint USING column::boolean::int::smallint;

It works, you wouldn't beleive it. ;)
Zdravko


pgsql-sql by date:

Previous
From: Marcin Krawczyk
Date:
Subject: Re: cast bool/int
Next
From: DM
Date:
Subject: Re: [GENERAL] pg_restore error - Any Idea?