Opened 11 years ago
Closed 5 years ago
#5015 closed defect (wontfix)
OCI driver gets wrong dimension if a table exists multiple times in ALL_SDO_GEOM_METADATA
Reported by: | aheinecke | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | OGR_SF | Version: | 1.9.1 |
Severity: | normal | Keywords: | |
Cc: | ilucena, grasslandtom |
Description
In our Oracle setup where we had different users that owned tables of the same name ogr inserted features with the sdo.gtype 8006 which is invalid as 8 is not a valid value for the dimension of the type. ( http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_objrelschema.htm#i1005614 )
This was caused by the geometry identification in ReadTableDefinition, which executed the statement: SELECT COUNT(*) FROM ALL_SDO_GEOM_METADATA u, TABLE(u.diminfo) t WHERE u.table_name = 'RIVER_AXES' AND u.column_name = 'GEOM';
To determine the dimension of the layer. This is wrong as this results in the sum of the dimensions of all tables with that name and not just the one that is currently read. (Returns 8 on our system as we have the table twice with three dimensional geometrys and once with a two dimensional geometry)
This also happens when getting the extent (using min/max over all tables instead of only the users tables).
Is there a need that this is done in the ALL table and not the USER table? And if so shouldn't then OWNER be added to the clause?
Changing the references in ALL_SDO_GEOM_METADATA to USER_SDO_GEOM_METADATA in ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp fixed the problem for us.
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|
comment:3 by , 11 years ago
Thanks for clarifing this problem. Yes our user has select rights on the other tables and I agree that this should not be so, but apart from our database setup I still think there is a Bug in the OCI driver that it allows the data inserted to be corrupted by such a setup.
I've tried adding an owner clause similary to the one used in UpdateLayerExtents to the statement but in my test case the owner can't be splitted of the table name.
comment:4 by , 11 years ago
Interpreting contents of SDO_GEOM_METADATA so that sdo.gtype=8006 is certainly a bug.
Perhaps driver should first run SELECT COUNT(*) FROM ALL_SDO_GEOM_METADATA u, TABLE(u.diminfo) t WHERE u.table_name = 'RIVER_AXES' AND u.column_name = 'GEOM'; and if the result is more than 1, demand user to give also OWNER?
comment:5 by , 7 years ago
Cc: | added |
---|
comment:6 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
Selecting between ALL_SDO_GEOM_METADATA vs.USER_SDO_GEOM_METADATA is not simple. Think about managed environment where data manager owns all the tables and grants minimum rights for the data users. After grant USER can read the metadata row from the ALL_SDO_GEOM_METADATA view but there is nothing to read from USER_SDO_GEOM_METADATA view (they are both really views to an internal table own by Oracle).
I am not sure but I feel that now all your users have select rights to each others tables. If you can, take those rights away and ALL_SDO_GEOM_METADATA should list only tables owned by the user.