[postgis-users] newbie: Error in first atttempt to use postgis with mapserver?

Nicolas Ribot nicky666 at gmail.com
Wed Jan 14 03:57:42 PST 2009


> Hi everyone.
> i've used workshop material of FOSS4G2007 to learn postgis along with its
> data. but there is a problem
> i got this error in first attempt to retrieve data from postgis:
>
> msDrawMap(): Image handling error. Failed to draw layer named
> 'bc_municipality'. prepare_database(): Query error. Error declaring cursor:
> ERROR: column "oid" does not exist LINE 1:
> ...inary(force_collection(force_2d(the_geom)),'NDR'),OID::text ... ^ With
> query string: DECLARE mycursor BINARY CURSOR FOR SELECT
> asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text from
> bc_municipality WHERE the_geom && setSRID('BOX3D(458426.1
> 260651.497368421,1943216.4 1373313.90263158)'::BOX3D,
> find_srid('','bc_municipality ','the_geom') )
> msPOSTGISLayerRetrievePGVersion(): Query error. Error executing POSTGIS
> statement (msPOSTGISLayerRetrievePGVersion():select substring(version() from
> 12 for (position('on' in version()) - 13))
>
> i don't know what causes the problem although it sounds easy.
> THX

Hi

MapServer is looking for the hidden OID column, that does not exist
anymore in recent postgresql versions (tables are now created without
oid by default.
Try adding a "USING unique <ID>" in your mapfile postgis data
connection (replace <ID> by a unique identifier defined for the
bc_municipality table.

What Mapserver version are you using ?

HTH
Nicolas



More information about the postgis-users mailing list