Re: Cast character to boolean - Mailing list pgsql-general

From Edmund.Bacon
Subject Re: Cast character to boolean
Date
Msg-id 47E3F61E.4000609@shaw.ca
Whole thread Raw
In response to Re: Cast character to boolean  ("Roberts, Jon" <Jon.Roberts@asurion.com>)
List pgsql-general
Roberts, Jon wrote:
> A case statement will work just fine:
>
> select case when sub.col1 = 'y' then true else false end as
> col1_boolean, sub.col1 from (select cast('y' as varchar) as col1) sub

Be aware of the danger here.  What happens if col1 is NULL?

pgsql-general by date:

Previous
From: "Webb Sprague"
Date:
Subject: Re: Table size
Next
From: "Adam Rich"
Date:
Subject: Re: MySQL to Postgres question