Opened 18 years ago

Closed 18 years ago

#1629 closed defect (fixed)

queryByAttributes creates wrong WHERE clause on PostGIS layers

Reported by: ml.dje@… Owned by: refractions
Priority: high Milestone:
Component: PostGIS Interface Version: 4.8
Severity: critical Keywords:


Using Mapserver 4.8.0-beta2 Windows (from the following call

$msLayer->queryByAttributes('myAttribute', 'myAttribute in ('A', 'B')', MS_MULTIPLE)

results in the following WHERE-clause send to Postgres

.. WHERE (myAttribute = 'myAttribute in ('A', 'B')') and ...

which oviously results in an error. Version 4.6.1 on the other hand creates the
correct clause:

... WHERE (myAttribute in ('A', 'B')) and ...

Is this issue probably solved in the newer 4.8-RC versions?

Attachments (1)

bug1629.patch (2.2 KB ) - added by unicoletti 18 years ago.
Revert behaviour of FILTERITEM to pre 1.61

Download all attachments as: .zip

Change History (7)

comment:1 by dmorissette, 18 years ago

Cc: unicoletti@… dmorissette@… added
Component: MapScript-PHPPostGIS Interface
Owner: changed from mapserverbugs to refractions
Reassigned to the PostGIS guys. I don't remember hearing about this, so it is
probably not fixed in 4.8.

comment:2 by unicoletti, 18 years ago

Try to remove FILTERITEM and use FILTER parameter only, written as follows:

myAttribute in ('A', 'B')

Then postgis will generate the correct query.

This 'enhancement' was in fact added after 4.6.1.

As the docs say FILTERITEM is for 'OGR and shapefiles only'.

comment:3 by ml.dje@…, 18 years ago

I do not have any FILTER or FILTERITEM. The problem occurs with the
queryByAttributes function in PHP MapScript (maybe I was not completely clear in
this point).

comment:4 by unicoletti, 18 years ago

Status: newassigned
I have committed a patch for this in CVS HEAD. I attach the same patch here if
someone can confirm it then we will include it in 4.8 and close this issue.

by unicoletti, 18 years ago

Attachment: bug1629.patch added

Revert behaviour of FILTERITEM to pre 1.61

comment:5 by ml.dje@…, 18 years ago

I applied the patch and it works. Thanks very much.

comment:6 by unicoletti, 18 years ago

Resolution: fixed
Status: assignedclosed
Marking as fixed for now, the patch should be in 4.8.2.
Note: See TracTickets for help on using tickets.