Re: [GENERAL] Cast character to boolean

2008-03-21 Thread Edmund.Bacon
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? -- Sent via pgsql-general mailing list (pgsql

Re: [GENERAL] Cast character to boolean

2008-03-21 Thread Roberts, Jon
ROTECTED] On Behalf Of Gordon > Sent: Tuesday, March 18, 2008 10:18 AM > To: pgsql-general@postgresql.org > Subject: [GENERAL] Cast character to boolean > > I'm currently refactoring a database that somebody else designed. > When the database was designed he used character column

Re: [GENERAL] Cast character to boolean

2008-03-21 Thread Gordon
On Mar 19, 5:52 pm, [EMAIL PROTECTED] wrote: > On Mar 18, 9:18 am, Gordon <[EMAIL PROTECTED]> wrote: > > > > > I'm currently refactoring a database that somebody else designed. > > When the database was designed he used character columns with a length > > of 1 char to represent some values that rea

Re: [GENERAL] Cast character to boolean

2008-03-21 Thread elbacon
On Mar 18, 9:18 am, Gordon <[EMAIL PROTECTED]> wrote: > I'm currently refactoring a database that somebody else designed. > When the database was designed he used character columns with a length > of 1 char to represent some values that really should have been > represented as booleans. He used 'y

[GENERAL] Cast character to boolean

2008-03-21 Thread Gordon
I'm currently refactoring a database that somebody else designed. When the database was designed he used character columns with a length of 1 char to represent some values that really should have been represented as booleans. He used 'y' for true and 'n' for false. I want to cast these columns in