[mapserver-users] msPOSTGISLayerGetShape(): Error
Colin Wetherbee
cww at denterprises.org
Thu Feb 28 13:31:43 PST 2008
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
More information about the MapServer-users
mailing list