From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Confused about CASE |
Date: | 2008-03-01 00:21:15 |
Message-ID: | fqa7hr$v6b$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Adam Rich wrote on 01.03.2008 01:02:
>> "The data types of all the result expressions must be convertible to a
>> single output type."
>
> The type of the field pg_class.relkind appears to be "char" which is
> described in the notes as:
>
> The type "char" (note the quotes) is different from char(1) in that it
> only uses one byte of storage. It is internally used in the system catalogs
> as a poor-man's enumeration type.
>
> http://www.postgresql.org/docs/8.3/interactive/datatype-character.html
>
> But one would expect "char" to be "convertible" to text for the purposes
> of CASE. Both implicit and explicit cast to text seems to work fine.
OK, I'm glad it boils down to a datatype issue ;)
My SQL frontend reported that column as char(1) so I didn't notice the subtle
difference (actually the JDBC driver returns char, not "char") and tested it
agains a table with (int, char(1)).
Using c.relkind::text works fine.
Thanks for all the answers
Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Dee | 2008-03-01 00:42:58 | Re: beginner: what permissions required to install on windows 2000+ |
Previous Message | pw | 2008-03-01 00:10:11 | Re: Querying Headers |