[mapserver-users] msPOSTGISLayerGetShape(): Error

Paul Moen pmoen at nd.gov
Thu Feb 28 16:07:54 EST 2008


I just upgraded to postgres 8.2.6

And postgis 1.3.2("POSTGIS="1.3.2" GEOS="3.0.0rc4-CAPI-1.3.3" PROJ="Rel.
4.6.0, 21 Dec 2007" USE_STATS") and I get the following error.

PHP Fatal error:  [MapServer Error]: msPOSTGISLayerGetShape(): Error
executing POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor2 BINARY
CURSOR FOR SELECT 
"site_id"::text,"location"::text,"longitude"::text,"latitude"::text,"county"
::text,"status"::text,"arb_siteno"::text,"last_name"::text,"first_name"::tex
t,"add1"::text,"add2"::text,"city"::text,"state"::text,"zip"::text,"phone"::
text,"remarks"::text,"password"::text,"email"::text,"online_reporting"::text
,"x_coord"::text,"y_coord"::text,asbinary(force_collection(force_2d(geom)),'
NDR') from station WHERE site_id = 4243
-ERROR:  cannot cast type boolean to text, referer: http://10.8.54.31/
: ..."::text,"latitude"::text,"county"::text,"status"::text,"arb_...,
                                                       ^,

My table in postgresql is

CREATE TABLE station
(

    site_id integer NOT NULL DEFAULT 0,
    "location" character varying(14) NOT NULL DEFAULT '',
    longitude double precision NOT NULL DEFAULT 0,
    latitude double precision NOT NULL DEFAULT 0,
    county character varying(30) NOT NULL DEFAULT '',
    status boolean NOT NULL DEFAULT false,
    arb_siteno character varying(5) NOT NULL DEFAULT '',
    last_name character varying(35) NOT NULL DEFAULT '',
    first_name character varying(20) NOT NULL DEFAULT '',
    add1 character varying(21) NOT NULL DEFAULT '',

    add2 character varying(21) NOT NULL DEFAULT '',
    city character varying(20) NOT NULL DEFAULT '',
    state character varying(2) NOT NULL DEFAULT '',
    zip character varying(9) NOT NULL DEFAULT '',
    phone character varying(10) NOT NULL DEFAULT '',
    remarks text NOT NULL DEFAULT '',
    "password" character varying(20) NOT NULL DEFAULT '',
    email character varying(80) NOT NULL DEFAULT '',
    online_reporting boolean NOT NULL DEFAULT false,
    x_coord integer NOT NULL DEFAULT 0,
    y_coord integer NOT NULL DEFAULT 0,
    geom geometry,
)

My mapscript version is

MapServer Version    MapServer version 5.0.2 OUTPUT=GIF OUTPUT=PNG
OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG
SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
PHP MapScript Version    ($Revision: 7251 $ $Date: 2008-01-08 09:04:53 -0800
(Tue, 08 Jan 2008) $)

All running on Mac OS 10.5.

msPOSTGISLayerGetShape() tries to cast the status column to text, did it
always do that?  

PostgreSQL 8.3 will have a type cast from boolean to text.  But none of the
earlier versions were supposed to.

I can run the sql 
SELECT status::text from station
with no errors in PostgreSQL 8.2.4 but not in 8.2.5 or 8.2.6, which leads me
to believe that there was in a cast from boolean to text in 8.2.4.

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?

Thanks,

Paul



More information about the mapserver-users mailing list