[gdal-dev] stack smashing when using ogrinfo with DB2 driver

Even Rouault even.rouault at spatialys.com
Thu Nov 2 14:10:20 PDT 2017


> 
> Another question is - why does VRT driver switch a layer to read only mode
> when using FID tag to specify primary key column?

I can just answer on that non-DB2 specific part. The reason is that when explicitly setting FID, 
when you want to update the underlying layer, you'd need to access its real FID, but, in the 
general case, the exposed FID at the VRT level cannot be matched with the underlying FID.

For example imagine you have a CSV file with

my_id,foo
10,"bar"
11",baz"

For the OGR CSV driver, the FID of this CSV file is implicit. The first record will be FID 1, the 
next one 2

If in your VRT you set <FID>my_id</FID>, then in the OGR VRT layer, you'll have 2 features of 
FID 10 and 11.
If you do SetFeature(vrt_feature) where vrt_feature.my_id = 11, the VRT driver would have to 
realize that this vrt_feature.my_id= 11 corresponds to csv_feature.implicit_id = 2. Which he 
cannot do efficiently (would require a full scan)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171102/04c18a3b/attachment.html>


More information about the gdal-dev mailing list