Opened 16 years ago
Closed 16 years ago
#2817 closed defect (fixed)
PostGIS Expression bug
| Reported by: | paalkr | Owned by: | pramsey |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PostGIS Interface | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: | sdlime |
Description
The new PostGIS support introduced a bug when using CLASSITEM and EXPRESSION. String comparison does not work, se the example below:
Does NOT work:
LAYER
...
CLASSITEM "maxhoyde"
...
CLASS
NAME "test"
EXPRESSION "600"
...
END
END
Using RegEx instead WORKS:
LAYER
...
CLASSITEM "maxhoyde"
...
CLASS
NAME "test"
EXPRESSION /600/
...
END
END
Using logical expression WORKS:
LAYER
...
#CLASSITEM "maxhoyde"
...
CLASS
NAME "test"
EXPRESSION ([makshoyde] == 600)
...
END
END
Change History (10)
comment:1 by , 16 years ago
| Cc: | added |
|---|
comment:2 by , 16 years ago
| Cc: | removed |
|---|---|
| Owner: | changed from to |
follow-up: 4 comment:3 by , 16 years ago
comment:4 by , 16 years ago
Replying to pramsey:
I tried to replicate this, but I can't: it works for me. Can you attach a table dump and map file please?
Hi!
I have prepared a table dump and a mapfile, the zip archive is approx 1.6 MB so it's too large to attach, but can be download from | this link
comment:5 by , 16 years ago
what should this test case generate? I am assuming that, if the bug is present, it should generate nothing, as none of the classes will match. However, I am getting a picture, which implies that it is still working on my installation, which is bad news, since it implies a more subtle bug than one might like, something related to platform.
comment:7 by , 16 years ago
Are you sure this ever worked in previous versions? I see an issue (the size is always returned as the field width (5) so the string values are things like "600 " and "1200 ", but that issue also exists in 5.2 and previous.
comment:8 by , 16 years ago
Allow me to answer my own question. In previous versions the cursor was binary, so the records returned were probably null terminated at the end of the string. Now that I have a text cursor, things seem to have changed, and the null terminators are at the end of the *record*. I could strip trailing white space, but that may lead to other future problems...
comment:9 by , 16 years ago
This should be "fixed" as of r8238, though I am not 100% comfortable with the fix at this moment. I am simply lopping off all the trailing spaces. This might be refined to only do so in cases where the field type is fixed width. Some experimentation will be needed to find the field types that exhibit the behavior of returning a fixed value for PQgetlength no matter how wide the actual data is.
comment:10 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

I tried to replicate this, but I can't: it works for me. Can you attach a table dump and map file please?