Ticket #1629 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

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:
Cc:

Description

Using Mapserver 4.8.0-beta2 Windows (from maptools.org) 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

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

Change History

Changed 7 years ago by dmorissette

  • cc unicoletti@…, dmorissette@… added
  • owner changed from mapserverbugs to refractions
  • component changed from MapScript-PHP to PostGIS Interface
Reassigned to the PostGIS guys. I don't remember hearing about this, so it is
probably not fixed in 4.8.

Changed 7 years ago by unicoletti

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'.

Changed 7 years ago by ml.dje@…

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).

Changed 7 years ago by unicoletti

  • status changed from new to assigned
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.

Changed 7 years ago by unicoletti

Revert behaviour of FILTERITEM to pre 1.61

Changed 7 years ago by ml.dje@…

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

Changed 7 years ago by unicoletti

  • status changed from assigned to closed
  • resolution set to fixed
Marking as fixed for now, the patch should be in 4.8.2.
Note: See TracTickets for help on using tickets.