Bug report #5769

Test filter in old query builder incorrect

Added by Andreas Neumann over 8 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:15270

Description

If one filters a vector layer in the general tab --> Query Builder one can test the where clause.
However, the result of the number of resulting features is incorrect and always shows the total numbers of features per layer and not the counts of the filtered results.


Related issues

Duplicated by QGIS Application - Bug report #16915: estimatedmetadata=true parameter on postgres datasource r... Closed 2017-07-22

History

#1 Updated by Andreas Neumann over 8 years ago

  • Priority changed from High to Severe/Regression

#2 Updated by Jürgen Fischer over 8 years ago

Are you querying a postgis layer with "use estimated meta data" checked? Then the feature count is inaccurate, but fast. See also ![Qgis-developer] Reverse Changeset 13499 and a5796853

#3 Updated by Nathan Woodrow over 8 years ago

Confirmed with PostGIS using "use estimated meta data" checked. Not really a blocker IMO.

#4 Updated by Andreas Neumann over 8 years ago

Hi,

Yes - the problem only arises when using "estimated meta data". I don't understand how the "estimated metadata" setting is related to the test filter. Why can't the test filter use a more accurate method?

Shouldn't the estimated meta data setting only speed up the initial table listing of the PostgreSQL provider?

If the issue can't be solved - can't we at least issue a warning that with the setting "use estimated metadata" the test filter returns wrong results?

Thanks,
Andreas

#5 Updated by Jürgen Fischer over 8 years ago

  • Priority changed from Severe/Regression to Normal

Andreas Neumann wrote:

Yes - the problem only arises when using "estimated meta data". I don't understand how the "estimated metadata" setting is related to the test filter. Why can't the test filter use a more accurate method?

Because the query builder is provider independant. it just set a subset string and retrieves the feature count.

Shouldn't the estimated meta data setting only speed up the initial table listing of the PostgreSQL provider?

No, it speeds up querying large layers in general.

If the issue can't be solved - can't we at least issue a warning that with the setting "use estimated metadata" the test filter returns wrong results?

The impact of "use estimated table metadata" is documented in the help of the dialog where you enable it - and it's not default.

We could introduce an accurate feature count option - but that would change the provider interface.

#6 Updated by Paolo Cavallini about 8 years ago

  • Target version set to Version 2.0.0

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

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#8 Updated by Andreas Neumann over 3 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented

Apparently this works find now, at least for PostgreSQL layers.

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

  • Duplicated by Bug report #16915: estimatedmetadata=true parameter on postgres datasource reports wrong number of features when filtering layer added

Also available in: Atom PDF