Bug report #13005

QgsOracleFeatureIterator: returns all features if layer has no index

Added by Frank Dekervel about 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:Jürgen Fischer
Category:Data Provider/Oracle
Affected QGIS version:2.8.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21082

Description

Hello,

i'm using QGis to show a view with a computed geometry column (and hence, i don't have a spatial index).
When i try to use the identify tool on this view, QGIS crashes (it tries to select all features in the layer).

This is because of a bug in QgsOracleFeatureIterator (i think):
  • the identify tool uses FilterRect
  • in the FilterRect handling, there is a big if:
    if ( !mSource->mGeometryColumn.isNull() && mSource->mHasSpatialIndex )
    
  • if hasSpatialIndex is false, it won't enter the if and add no WHERE clause to the query at all, hence all features are selected.
i think the desired behaviour is that

i don't fully understand how this might be related to solved bug #11358

Frank

Associated revisions

Revision dfc2cf0b
Added by Jürgen Fischer about 5 years ago

oracle provider: fix ExactIntersect check if spatial extension is available and there is no spatial index (fixes #13005)

Revision 318137ae
Added by Jürgen Fischer about 5 years ago

oracle provider: fix dfc2cf0 (fixes #13005; take II)

Revision 32414c54
Added by Jürgen Fischer about 5 years ago

oracle provider: fix ExactIntersect check if spatial extension is available and there is no spatial index (fixes #13005)

(cherry-picked from dfc2cf0 & 318137a)

History

#1 Updated by Jürgen Fischer about 5 years ago

  • Status changed from Open to Closed

#2 Updated by Jürgen Fischer about 5 years ago

sdo_filter requires a spatial index. sdo_relate is only available with the spatial extension (ie. not in oracle locator).

So in QGIS sdo_filter is used to detect if there is a spatial index (if everything else fails) and to filter in a feature request with FilterRect - but only if there is a spatial index. And if the feature request also has the ExactIntersect flag set and the spatial extension it available it is combined with sdo_relate.

So if there is no spatial index or no spatial extension all features have to be loaded and have to be individually checked against the FilterRect. But tht was only done when there was no spatial extension regardless of the existence of a spatial index. dfc2cf0 should fix that.

#3 Updated by Frank Dekervel about 5 years ago

i tried nightly of today (61d81f0), and it doesn't seem to be solved: qgis still selects all the features when i try to identify one.

i can't find why it doesn't work (the commit looks correct)

i still see that zooming and panning the map goes reasonably quick, even selecting nodes using the selection tool works fine (strange ?).

#4 Updated by Frank Dekervel about 5 years ago

  • Status changed from Closed to Reopened

hello,

i think i found the cause why it isn't working yet. inside the "if" you changed in dfc2cf0, there is another check in "line 148":#dfc2cf0bbf7516886d6cbf7cb3211bbc023df19b#diff-3930f82a72360b839dd9bc0a39e4cd97L148 for hasSpatial that needs to be changed too

frank

#5 Updated by Jürgen Fischer about 5 years ago

  • Status changed from Reopened to Closed

#6 Updated by Frank Dekervel about 5 years ago

working fine in latest nightly.

thanks for the fix !

Frank

Also available in: Atom PDF