Bug report #11116

Better support of dynamic queries on Oracle provider

Added by Médéric RIBREUX about 10 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/Oracle
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:19446

Description

Hello,

since QGis 2.4, we can load our own queries (sub-queries) instead of tables.

The queries can be added in a QGS project file by replacing the name of the table with the content of the query, enclosed by parenthesis.
QGis can open those queries and show the data on the canvas map but it emits an error log in the following form:

SQL : SELECT DISTINCT t."GEOM".SDO_GTYPE,t."GEOM".SDO_SRID FROM (SELECT "GEOM" FROM ""."(SELECT GID, GEOM FROM TEST_QGIS_S
)" WHERE "GEOM" IS NOT NULL AND rownum<=100) t WHERE NOT t."GEOM" IS NULL
erreur : ORA-01741: illegal zero-length identifier
Impossible de préparer la déclaration

The problem is that this query is not valid to Oracle. I believe that this query is made by QgsOracleConn::retrieveLayerTypes method when trying to determinate the geometry type.
According to the code, the query only handle table names and not query definitions.

This query should be modified to handle subqueries by deleting the quotes and the dot and ommitting the owner (layerProperty.ownerName).

Thanks for fixing this (non blocking but just annoying) bug in order to increase dynamic SQL queries support of QGis...

History

#1 Updated by Giovanni Manghi over 7 years ago

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

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

  • Assignee deleted (Jürgen Fischer)

#3 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF