Bug report #7780

Incorrect number of rows when testing layer filter expression

Added by Alexandre Neto almost 11 years ago. Updated almost 7 years ago.

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

Description

When one tests the layer filter expression, the number of rows showed is the total number of row in the layer instead of the result of the filter.

The filter works well.

Does not happen in 1.8, it's a regression, so I set it as a blocker.


Related issues

Duplicated by QGIS Application - Bug report #8503: Postgis query test returns all rows, not query result Closed 2013-08-22
Duplicated by QGIS Application - Bug report #12545: Wrong features count filtering a Postgresql layer Closed 2015-04-10
Duplicated by QGIS Application - Bug report #14542: Test of query of a postgresql layer always show the total... Closed 2016-03-21

History

#1 Updated by Matthias Kuhn almost 11 years ago

  • Priority changed from Severe/Regression to Normal

From qgspostgresprovider.cpp (Line 2315):

  // use estimated metadata even when there is a where clause,
  // although we get an incorrect feature count for the subset
  // - but make huge dataset usable.

  if ( !mIsQuery && mUseEstimatedMetadata )

The currently supported solution is to disable "Use estimated metadata" for your database connection.

If you see a better way of managing this issue, please share your ideas. I have changed the priority to Normal since this is expected behavior (although admittedly odd)

#2 Updated by Alexandre Neto about 10 years ago

I would not mind passing this issue to "Feature". And if there is no better solution, we could inform the user that he estimated metadata was used and therefore the showed values might not be accurate.

#3 Updated by Paolo Cavallini about 10 years ago

  • Subject changed from Incorrect number o rows when testing layer filter expression to Incorrect number of rows when testing layer filter expression

#4 Updated by Paolo Cavallini about 10 years ago

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

#5 Updated by Sandro Santilli about 10 years ago

I was also bitten by this problem, still in 2.0 and in 2.2.
Being a regression from 1.8 I don't see how it becomes a feature request.

Another thing I don't see is why mIsQuery should disable estimation while filter should not, they both basically introduce a filtering, so should be both threated the same way, IMHO (ie: disabling the estimation)

#6 Updated by Giovanni Manghi almost 7 years ago

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

#7 Updated by Alexandre Neto almost 7 years ago

As far I understand, the "Use Estimated metadata" is not used by default. I can't remember if that was the case back then... anyway, I would close this ticket, the behavior is fully documented in here:

http://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/supported_data.html#creating-a-stored-connection

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

  • Resolution set to worksforme
  • Description updated (diff)
  • Status changed from Open to Closed

Also available in: Atom PDF