Paul Moen wrote:
I never added a custom cast to do this before, so I am wondering if the only
thing that changed is PostgreSQL?  Can anyone confirm that there was a cast
for boolean to text in PostgreSQL 8.2.4?

Here's the sort of cast you want, by the way:


cww=# SELECT a::text FROM foo;
ERROR:  cannot cast type boolean to text
cww=# select a::char::text from foo;
ERROR:  cannot cast type boolean to character

cww=# CREATE OR REPLACE FUNCTION boolean_to_text (BOOLEAN) RETURNS CHAR STRICT AS $$ SELECT CASE WHEN $1 THEN 't' ELSE 'f' END $$ LANGUAGE sql;
CREATE FUNCTION
cww=# CREATE CAST (BOOLEAN AS CHAR(1)) WITH FUNCTION boolean_to_text(BOOLEAN) AS IMPLICIT;
CREATE CAST

cww=# SELECT a::char::text FROM foo;
 a
---
 f
 t
 t
(3 rows)


Colin
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to