Bug report #8503

Postgis query test returns all rows, not query result

Added by John Tull over 11 years ago. Updated over 10 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:master Regression?:No
Operating System:OS X Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17263

Description

For layers added from a postgis database, the query builder does not return the number of rows that a query expression results in, instead it reports the total number of rows in the table. This is also true if you use the query builder from the layer properties "General" tab.


Related issues

Duplicates QGIS Application - Bug report #7780: Incorrect number of rows when testing layer filter expres... Closed 2013-05-08

History

#1 Updated by Jürgen Fischer over 11 years ago

Are you using the "estimated metadata" option?

#2 Updated by John Tull over 11 years ago

Yes, and turning that off in the connection settings "fixes" the query count issue. As I recall, not using the estimated metadata imposed severe performance penalties on larger tables. Is the "estimated metadata" not compatible with the query test? In other words is this a bug or a limitation that cannot be overcome? If the latter, the test button should probably be unavailable if the estimated metadata setting is turned on, perhaps with a tooltip that says as much if you hover over the grayed-out button in the GUI.

#3 Updated by Jürgen Fischer over 11 years ago

John Tull wrote:

Yes, and turning that off in the connection settings "fixes" the query count issue. As I recall, not using the estimated metadata imposed severe performance penalties on larger tables.

Right.

Is the "estimated metadata" not compatible with the query test? In other words is this a bug or a limitation that cannot be overcome? If the latter, the test button should probably be unavailable if the estimated metadata setting is turned on, perhaps with a tooltip that says as much if you hover over the grayed-out button in the GUI.

There currently isn't a way for the provider to report that it is in capabable to deliver the right count in that mode - so that GUI cannot adapt.

But the option isn't default (for the reason, that it produces unreliable results in cases like this) and the documentation points that out (context help: This can drastically speed up operations on large datasets, but may result in incorrect characterization of layers (eg. the feature count of filtered layers will not be accurately determined).)

#4 Updated by Giovanni Manghi about 11 years ago

  • Status changed from Open to Feedback

seems really duplicate of #7780 please close this.

#5 Updated by Paolo Cavallini almost 11 years ago

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

#6 Updated by Matthias Kuhn over 10 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF