Hi Even, Thanks for the clarification. By the way, the behavior with QuietDelete may be different with SQLite driver but the messages are the same:
GDAL: GDALOpen(foo.sqlite, this=0000000001DD6450) succeeds as SQLite. RASTERLITE: SQLite DB Open OGR: Unloading VirtualOGR module GDAL: GDALClose(foo.sqlite, this=0000000001DD6450) SQLITE: OGR style SQLite DB found ! OGR: Unloading VirtualOGR module GDAL: QuietDelete(foo.sqlite) invoking Delete() GDAL: GDALDriver::Create(SQLite,foo.sqlite,0,0,0,Unknown,0000000000000000) ERROR 1: It seems a file system object called 'foo.sqlite' already exists. ERROR 1: sqlite driver failed to create foo.sqlite -Jukka- Lähettäjä: Even Rouault [mailto:even.roua...@spatialys.com] Lähetetty: 9. toukokuuta 2018 19:43 Vastaanottaja: gdal-dev@lists.osgeo.org Kopio: Rahkonen Jukka (MML) <jukka.rahko...@maanmittauslaitos.fi> Aihe: Re: [gdal-dev] Ogr2ogr, SQLite and overwriting existing database Hi, > What is the expected behavior if user asks ogr2ogr to create a SQLite > database that already exists? The driver page > http://www.gdal.org/drv_sqlite.html tells that "The SQLite driver supports > creating new SQLite database files, or adding tables to existing ones. Note > that a new database file cannot be created over an existing file." Outdated statement from 1.X era (just removed it). Now that the SQLite driver is a GDAL driver, it follows the general mechanism of deleting the existing file. > > But if I lock the existing database by creating a connection into it I get > these messages: ERROR 1: A file system object called 'foo.gpkg' already > exists. > ERROR 1: gpkg driver failed to create foo.gpkg > > Does "ERROR 1: A file system object called 'foo.gpkg' already exists." mean > that the purpose to prevent overwriting but the check does not work? I have > been using quit overwriting as a feature but is it actually a bug? This is a particularity of the GPKG driver. The file should have normally deleted but due t thhe lock QuietDelete() failed. And the GPKG driver has a specific code to prevent overwriting of an exiting file in its Create() method. In fact it errors out if APPEND_SUBDATASET=YES is not specified, and if it is specified it happens a new raster dataset to the existing file Even -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev