Skip to content
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

QGIS select by expression mismatch with MSSQL layers #25320

Closed
qgib opened this issue Nov 8, 2017 · 10 comments
Closed

QGIS select by expression mismatch with MSSQL layers #25320

qgib opened this issue Nov 8, 2017 · 10 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers

Comments

@qgib
Copy link
Contributor

qgib commented Nov 8, 2017

Author Name: Solution s (Solution s)
Original Redmine Issue: 17423
Affected QGIS version: 2.18.14
Redmine category:data_provider/mssql


When trying to select features using "select by expression", QGIS did select a wrong feature in this case.
I tried on two different days, same result (so I have restarted the PC and QGIS).

What i did was:

  1. Load a layer and select it to use select by expression
  2. Made sure that no features are selected in any layer
  3. Clicked the select by expression button from the toolbar
  4. Put in a very simple criteria: "matrikelnummer" = '10ae'
  5. Clicked select/vælg (see Screenshot_1.png)
  6. In Screenshot_2.png you can see which features QGIS selected in the opened attribute table. As you can see, feature with ID = 8337 (or just line 43) is selected. This should not be selected, because '10ae' != '10an'

Instead it should have selected line 24 (ID = 8339), because as you can see that have '10ae' as the "matrikelnummer"

  1. I also tried to resize the window to see if it was a graphical glitch, no luck.

Interestingly, the layer filter is able to select/filter the correct features.
What i did to further test expressions was:

  1. Deselect all features
  2. Opened up the layer's filter and tested the expression. Correctly returned 2 rows as you can see on Screenshot_3.png
  3. Applied the filter and opened the attribute table. As you can see on Screenshot_4.png the correct features is viewed.

Some information about the layer:

  • The layer is calld Hovedejer matrikel
  • MSSQL spatial data provider
  • srid=25832
  • Polygon (WKB type: "Polygon")
  • (MyGeom)
  • character encoding infomation not available, but since æ, ø, å is displayed correctly, I would guess that it's one that follows this standard: https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Similar_character_sets
    ** Interestingly nothing is shown in the layer properties window under "Data Source Encoding", and I'm not able to select any option (there is none).
  • I think the layer is provided by a Microsoft server

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2017

Author Name: Solution s (Solution s)


Additional layer/field information:
The field "matrikelnummer" type is QString and typename is varchar. Max length 40, precision 0.

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2017

Author Name: Giovanni Manghi (@gioman)


Does it happens for other providers (like PostGIS) or datasources? Can you test on a more recent release? Thanks.


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2017

Author Name: Solution s (Solution s)


Works fine on this layer:

  • PostgreSQL database with PostGIS extension
  • key='gid'
  • srid=25832
  • type=MultiPolygon

I will try as soon as I get my administrator to update QGIS.

@qgib
Copy link
Contributor Author

qgib commented Nov 8, 2017

Author Name: Giovanni Manghi (@gioman)


  • status_id was changed from Feedback to Open
  • category_id was changed from Expressions to Data Provider/MSSQL

@qgib
Copy link
Contributor Author

qgib commented Nov 9, 2017

Author Name: Giovanni Manghi (@gioman)


  • subject was changed from QGIS select by expression mismatch to QGIS select by expression mismatch with MSSQL layers

@qgib
Copy link
Contributor Author

qgib commented Nov 10, 2017

Author Name: Solution s (Solution s)


I uninstalled QGIS 2.18.11 and installed 2.18.14.
I can reproduce the issue on 2.18.14.

@qgib
Copy link
Contributor Author

qgib commented Nov 13, 2017

Author Name: Giovanni Manghi (@gioman)


  • version was changed from 2.18.11 to 2.18.14

@qgib
Copy link
Contributor Author

qgib commented Oct 2, 2018

Author Name: Nyall Dawson (@nyalldawson)


Can you provide a SQL dump of part of this layer?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Jan 20, 2019

Author Name: Jürgen Fischer (@jef-n)


Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

@qgib
Copy link
Contributor Author

qgib commented Feb 24, 2019

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to no timely feedback
  • status_id was changed from Feedback to Closed

@qgib qgib closed this as completed Feb 24, 2019
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers
Projects
None yet
Development

No branches or pull requests

1 participant