| From: | Gordon <gordon(dot)mcvey(at)ntlworld(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Cast character to boolean |
| Date: | 2008-03-18 15:18:01 |
| Message-ID: | 760c77d7-dc13-4068-bf5b-e13f92dbf7ad@2g2000hsn.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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 into the correct type, because you could
in theory set the columns in question to any single character value.
I don't seem to be able to do so, however, the database keeps claiming
that the cast cannot be done.
I tried casting the columns in question to character varying and then
changing all the 'y's to 'TRUE's, and all the 'n's to 'FALSE's. This
wasn't a problem. But casting from this format to boolean still gives
an error.
Does anybody know how to do this?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Devrim GÜNDÜZ | 2008-03-18 16:02:11 | Re: 8.3.0 upgrade |
| Previous Message | Bruce Momjian | 2008-03-18 14:57:20 | Re: Feature request/suggestion - CREATE SCHEMA LIKE |