Opened 15 years ago
Closed 15 years ago
#2937 closed defect (fixed)
FILTER makes ambiguous WHERE clause when more than one component is given
Reported by: | dougrenwick | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 5.4 release |
Component: | PostGIS Interface | Version: | svn-trunk (development) |
Severity: | major | Keywords: | postgis filter ambiguous or statement |
Cc: |
Description
This was originally reported by Jennifer Shanks, and diagnosed by me. The version in use was 5.4 beta 3
Problem: The following FILTER will return incorrect records. I do not have the program context, only that it was part of a click-query.
FILTER "code = 'Restricted' or code = 'Open'"
Diagnosis: The generated SQL clause was as follows:
WHERE code = 'Restricted' or code = 'Open' and gid = 12345
This appears to be a bug in PostGIS, where the gid component is added and making an ambiguous order of operations.
Workaround: Using parentheses can disambiguate and solve the problem:
FILTER "(code = 'Restricted' or code = 'Open')"
Note:
See TracTickets
for help on using tickets.
Patched in trunk at r9045 and in 5.4 branch at r9046.