[postgis-users] Cast boolean to text

Michael Fuhr mike at fuhr.org
Sat Oct 20 08:46:12 PDT 2007


On Wed, Oct 17, 2007 at 02:37:17PM -0600, Pete Deffendol wrote:
> After suddenly receiving errors in my Mapserver install, I tracked the 
> problem down to a missing cast from boolean to text type.  In earlier 
> releases of PostGIS (1.2.x), the lwpostgis.sql file did the following:
> 
> CREATE CAST (bool AS text) WITH FUNCTION ST_text(bool) AS IMPLICIT;
> 
> In version 1.3.1, this line is commented out of lwpostgis.sql.  I can't 
> find any reference to the change in the Changelog.  Was it disabled for any 
> particular reason?

I submitted a patch in June to create the boolean-to-text cast only
in PostgreSQL versions earlier than 8.3 because that cast had just
been committed to 8.3devel, causing the PostGIS regressions tests
to fail when trying to create the cast again:

http://postgis.refractions.net/pipermail/postgis-devel/2007-June/002581.html

Mark Cave-Ayland expressed surprise that PostGIS was creating a
cast over native PostgreSQL types at all:

http://postgis.refractions.net/pipermail/postgis-devel/2007-June/002583.html

Testing revealed that the regression tests didn't need the cast:

http://postgis.refractions.net/pipermail/postgis-devel/2007-June/002588.html

Here's the commit that commented out the cast:

http://postgis.refractions.net/pipermail/postgis-commits/2007-June/000080.html

Have you found some part of PostGIS that requires the cast?  If so
then I'd suggest modifying PostGIS to work without it (e.g., by
using a CASE expression) so PostGIS doesn't have to create casts
over types that aren't its own.

-- 
Michael Fuhr



More information about the postgis-users mailing list