[gdal-dev] When and why ogrinfo sends update for Oracle?

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Wed Aug 22 03:11:22 PDT 2012


Hi,

I learned to use ogrinfo with --debug on lately and it revealed what
all happens after sending plain ogrinfo through OCI driver. A few
lines interest me. What is the meaning to doing the select from
ALL_SDO_GEOM_METADATA then insert into USER_SDO_GEOM_METADATA as
follows?

OCI: Prepare(select min(case when r=1 then sdo_lb else null end) minx,
min(case when r=2 then sdo_lb else null end) miny, min(case when r=1
then sdo_ub else null end) maxx, min(case when r=2 then sdo_ub else
null end) maxy from (SELECT d.sdo_dimname, d.sdo_lb, sdo_ub,
sdo_tolerance, rownum r FROM ALL_SDO_GEOM_METADATA m, table(m.diminfo)
d where m.table_name = UPPER('TABLE') and m.COLUMN_NAME =
UPPER('GEOM') ) )

OCI: Prepare(UPDATE USER_SDO_GEOM_METADATA SET DIMINFO =
MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',2899987.997,4000000.003,
0.001),MDSYS.SDO_DIM_ELEMENT('Y',5999987.997,8000000.003,0.001)) WHERE
TABLE_NAME = 'TABLE')

I guess that meaning is to check all the metadata rows from the
ALL_SDO_GEOM_METADATA view which are referring to the queried table.
There can be several rows created be different Oracle users. Next the
maximum BBOX is constructed and that is updated into
USER_SDO_GEOM_METADATA view.

I have couple of questions:

- Why this update? Perhaps for making sure that bbox reported by
ogrinfo covers the whole area? - Is it correct to take the max values
from mins? Looking at min(case when r=1 then sdo_ub else null end)
maxx - What happens if Oracle user running ogrinfo or ogr2ogr has
limited rights? Case 1: OGR user does not have select rights for
all_sdo_geom_metadata but updating user_sdo_geom_metadata is OK. Will
minx, miny, maxx, maxy in diminfo be updated to nulls? Case 2: Select
is OK but OGR user does not have right to update
user_sdo_geom_metadata.

This is realistic in enterprise environment if OGR user is only making
reports of something like that.

-Jukka Rahkonen-



More information about the gdal-dev mailing list