queryByAttributes and postgis
Francesco
fcadili at NGI.IT
Thu Jun 1 06:55:28 PDT 2006
Hello, I have a problem when using mapserver with postgis to perform a
queryByAttribute on a layer.
The problem disapear when using the same data with shape files.
The error returned by teh mapscript middleware is:
<<<<<Start of the error:
Jun 01 14:35:50 Seagull [alert] clickmgr->performquery: The query give
the following error: ms_error_obj Object
(
[_handle_] => Resource id #372
[code] => 23
[routine] => prepare_database()
[message] => Error executing POSTGIS DECLARE (the actual query)
statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
cod_concio::text,VISTA::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text
from conci_data.conci WHERE (cod_concio = '3523 AND cod_concio = 6087
AND cod_concio = 6092') and (the_geom && setSRID( 'BOX3D(-6600
-6748.21739130435,838
-603.782608695652)'::BOX3D,find_srid('','conci_data.conci','the_geom')
))' <br><br>
Postgresql reports the error as 'ERROR: invalid input syntax for
integer: "3523 AND cod_concio = 6087 AND cod_concio = 6092"
'<br><br>
More Help:<br><br>
Error with POSTGIS data variable. You specified '<check your .map
file>'.<br>
Standard ways of specifiying are : <br>
(1) 'geometry_column from geometry_table' <br>
(2) 'geometry_column from (<sub query>) as foo using unique
<column name> using SRID=<srid#>' <br><br>
Make sure you put in the 'using unique <column name>' and 'using
SRID=#' clauses in.
<br><br>For more help, please see
http://postgis.refractions.net/documentation/
<br><br>Mappostgis.c - version of Jan 23/2004.
)
<<<<<End of the error:
The parameter given to the queryByAttribute was:
Jun 01 14:35:50 Seagull [debug] clickmgr->performquery: 2st step: do the
query (queryItem = cod_concio, queryString = 3523 AND cod_concio = 6087
AND cod_concio = 6092)
I tried different string such as:
3523' OR cod_concio = '6087' OR cod_concio = '6092 (OK, only postgis)
3523 OR cod_concio = 6087 OR cod_concio = 6092 (that does not work)
([cod_concio] in '3523,6087,6092')
(works on shape)
('[cod_concio]' in '3523,6087,6092')
(works on shape)
([cod_concio] = 3523 OR [cod_concio]=6087 OR [cod_concio] = 6092')
(works on shape)
Have any idea?
FrancescoI
More information about the MapServer-users
mailing list