Bug report #15709

bad match of valeurs with virtual layer

Added by Hugues Bernard about 7 years ago. Updated about 5 years ago.

Affected QGIS version:2.16.3 Regression?:No
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:23632


The values no match in the table of virtual layer with the source layer.

The difference is visible in:
- the display table
- on Identify Features tool with a specific entity (not on show all)

The labelling display is ok

see with attached files

value_virtual_no_match_shp_test.7z (708 KB) Hugues Bernard, 2016-10-14 09:21 AM

bug_value_on_virtualLayer.png (263 KB) Hugues Bernard, 2016-10-14 09:21 AM

Related issues

Related to QGIS Application - Bug report #15600: Selecting features feature in spatial views and virtual l... Open 2016-09-21

Associated revisions

Revision efe4a796
Added by Hugo Mercier about 5 years ago

Fix virtual layer FilterRect handling when no uid is defined (fixes #15709)

When no uid if defined, features returned have an id defined by an
autoincremented integer. So we cannot use a SQL filter here because it
would return a subset of features and then an autoincremented id that
does not correspond to ids without filters.

So in this case, all the features are requested and the rectangle
intersection is done by the provider, not by SQLite.


#1 Updated by Hugues Bernard about 7 years ago

The bug is also on the new version 2.18

Additional info, the virtual query is:
SELECT * FROM hafa_origin_03 WHERE indicatif LIKE '%03'

#2 Updated by Giovanni Manghi over 6 years ago

  • Regression? set to No
  • Easy fix? set to No

#3 Updated by Jürgen Fischer about 6 years ago

  • Category set to Unknown

#4 Updated by Nyall Dawson almost 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed
  • Description updated (diff)

Fixed in 2.18 and 3.0

#5 Updated by Hugues Bernard almost 6 years ago

  • Status changed from Closed to Reopened

The bug isn't fixed in 2.18. With the data joined at this the ticket, the problem is always present.

Tested the 2018-01-26 on version :
- rel 2.18.16-1
- rel dev 2.18.16-4

#6 Updated by Gerhard Spieles almost 6 years ago

the behavior is similar to #15600 and spatialite views have the same problem.

#7 Updated by Jürgen Fischer almost 6 years ago

  • Related to Bug report #15600: Selecting features feature in spatial views and virtual layers leads to wrong results added

#8 Updated by Hugo Mercier about 5 years ago

It is due to the virtual layer that does not have a unique id column defined.

In this case, the "id" will be an incremented integer for each row. The problem is when the identify tool is used, only one row is returned and the resulting id is then 1.

There is no easy way to automate the generation of a unique id for each row. I'm wondering if the right fix would be to prevent the identify tool to be used on layers without unique id.

#9 Updated by Hugo Mercier about 5 years ago

  • Status changed from Reopened to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF