Bug report #11843

Oracle provider is not able to handle non-geometric tables correctly

Added by Médéric RIBREUX almost 10 years ago. Updated almost 10 years ago.

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

Description

Hello,

it seems that the Oracle provider of QGis is not able to handle non-geometric tables correctly.

Under Python API, I've found that you need to use a QgsFeatureRequest with a flag set to NoGeometry to be able to fetch features.
This is not the default behavior as written in PyQGis cookbook and nor PostGIS or Spatialite ones.

The following code returns no feature on an Oracle non-geographic layer (even with a primary key). Under PostGIS and Spatialite, the code succeeds.

layer = QgsMapLayerRegistry.instance().mapLayersByName('MY_ATTRIBUTE_TABLE')[0]
for f in layer.getFeatures():
  print f

You have to restrict to a NoGeometry QgsFeatureRequest if you want to fetch features:

layer = QgsMapLayerRegistry.instance().mapLayersByName('MY_ATTRIBUTE_TABLE')[0]
for f in layer.getFeatures(QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)):
  print f

Furthermore, this bug seems to have a bad impact on the "Select by Expression" dialog: it is impossible to make a selection with this dialog on a non-geographic Oracle table. Whatever you type in the expression builder, the selection is always empty. I suspect that this problem is linked to the above one.

Steps to reproduce:
- Open a a non geographic table under Qgis and select it.
- Open the Select by Expression dialog on the loaded layer.
- Try to build a query selection expression like:

"FIELD1" LIKE '%avalue%'

or
"ID" = 0

- Clic on select button
- The selection is still empty

Best regards,

Associated revisions

Revision e5e85a54
Added by Jürgen Fischer almost 10 years ago

oracle provider: don't reject (none no)geometry queries on tables without geometry (fixes #11843)

History

#1 Updated by Jürgen Fischer almost 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF