[Mapserver-users] query postgis layer (boolean conversion problem)

Twan Kogels twan at twansoft.com
Fri Jul 4 02:25:27 PDT 2003


Hello,

2 days ago i posted a msg "bug #316 and ms4 missing functions" to this 
mailinglist. Bug #316 seems to have been fixed in the new mapserver 
version. But now i think i've found a new bug:

I try to query a postgis layer with mapscript, with the standard functions. 
When the table which you query contains a boolean column, the a error 
appears. When i remove the boolean column the error dissapears.

When querying a table with a boolean column i get the error:
============
MapServer Error in msPOSTGISLayerGetShape(): Error executing POSTGIS SQL 
statement (in FETCH ALL): DECLARE mycursor BINARY CURSOR FOR SELECT 
id::text,adlo1::text,adst1::text,adhu1::text,adto1::text,adpo1::text,adwo1::text,adwt1::text,adlo1_dg::text,adst1_dg::text,adhu1_dg::text,adto1_dg::text,adpo1_dg::text,adwo1_dg::text,adwt1_dg::text,adlo1_dsk::text,adst1_dsk::text,adhu1_dsk::text,adto1_dsk::text,adpo1_dsk::text,adwo1_dsk::text,adwt1_dsk::text,keurtype::text,site::text,

test::text,

asbinary(force_collection(force_2d(the_geom)),'NDR') from lg WHERE OID = 
574917 -ERROR: Cannot cast type boolean to text
More Help:
============
In this case column with name "test" is the boolean column.

When i remove the "test" column, everything goes oke and the correct data 
is returned without a error.

I'm using the new postgresql 7.3. I read in the docs that there where some 
changes with the boolean type. For example i cannot insert a empty string 
('') in a boolean column anymore (this was possible in other versions).

When looking at mappostgis.c (line 1118) (mapserver-4.0b, also in cvs 
version) i see the following code:
===========
for (t=0;t<layer->numitems; t++)
		{
			sprintf(temp,"%s::text,",layer->items[t]);
			strcat(columns_wanted,temp);
		}
===========
I suspect this converts the column value to text, this goes oke with non 
boolean columns, but not with boolean columns.

Is this really a bug, or am i just doing something terrible wrong?

Best regards,
Twan Kogels




More information about the MapServer-users mailing list