-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When styling a postgis layer with sld mapserver does bad casting of data (6.4.2) #5154
Comments
|
What version are you using? --Steve |
|
We are on version 6.4.2, sorry I should have included that in the issue |
|
@barryWarnock can you report if the issue is still present in 7.0? If not, I suspect there's little chance of it being fixed inside the 6.4 branch unless you fund or look into it yourself. |
|
After updating to 7.0 the words = '142_na text' request is now properly interpreted as a string but the filter: <ogc:Filter><ogc:PropertyIsEqualTo>
<ogc:PropertyName>words</ogc:PropertyName>
<ogc:Literal>4</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>is now converting the 4 to a float producing the query: select "words",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex') as geom,"ogc_fid" from z155f1a72fef4fb_types where wkb_geometry && ST_GeomFromText('POLYGON((3956364.52822967 3799323.09848486,3956364.52822967 5274852.04209296,5402120.21143023 5274852.04209296,5402120.21143023 3799323.09848486,3956364.52822967 3799323.09848486))',find_srid('','z155f1a72fef4fb_types','wkb_geometry')) and (((("words" = 4.000000))))so 7.0 stopped treating a string like a number if its first character was a digit but strings that are exclusively made up of digits seem to be treated as floats now. |
|
I’ll be taking a look at this. What is the data type of the words column in this case – we probably have to look at the column metadata to know how to handle this ambiguous case. From: barryWarnock [mailto:notifications@github.com] After updating to 7.0 the words = '142_na text' request is now properly interpreted as a string but the filter: ogc:Filterogc:PropertyIsEqualTo ogc:PropertyNamewords/ogc:PropertyName ogc:Literal4/ogc:Literal /ogc:PropertyIsEqualTo /ogc:Filter is now converting the 4 to a float producing the query: select "words",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex') as geom,"ogc_fid" from z155f1a72fef4fb_types where wkb_geometry && ST_GeomFromText('POLYGON((3956364.52822967 3799323.09848486,3956364.52822967 5274852.04209296,5402120.21143023 5274852.04209296,5402120.21143023 3799323.09848486,3956364.52822967 3799323.09848486))',find_srid(< span class="pl-s">'','z155f1a72fef4fb_types','wkb_geometry')) and (((("words" = 4.000000)))) so 7.0 stopped treating a string like a number if its first character was a digit but strings that are exclusively made up of digits seem to be treated as floats now. — |
|
The column type is text. |
|
Has anything been found relating to this issue? |
|
I hate to bump but has there been any progress on this issue? |
|
No progress but thank you for the reminder. I will do my best to spend a bit of time on it this week. |
|
What happens if you set an explicit type on the literal?
Steve |
|
seems not to be fixed in 7.2 beta? |
We are trying to style a layer stored in a postgis database using slds but when mapserver is generating the query for postgis it is improperly casting literal types.
for example with the data:
words (string) | numbers (int) | floats (floating point numbers)
part of canada | 1 | 1.0
142_na text | 66 | 6.6
4 | 3 | 3.0
text1 | 423 | 42.3
when we try to get the feature where words = 'part of canada' with the sld filter:
it works fine but if we try to get the feature where words = '142_na text' with the sld filter:
it fails with the error :
the full database query from the Mapserver log for this layer:
It looks like mapserver just sees that the first character is a number and decides to leave quotes off the whole value even though both the row type and literal type are actually strings.
If we try to get the feature where words = '4' with the sld filter:
it fails with the error :
As you can see this literal is also being treated as a number instead of a string but we get a different error because now instead of there being unquoted spaces postgres is now being asked to compare an int to a string.
The text was updated successfully, but these errors were encountered: