[gdal-dev] Ogr2ogr, SQLite and overwriting existing database

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Wed May 9 01:11:19 PDT 2018


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."

However, all these commands do overwrite the existing SQlite database

ogr2ogr -f sqlite -dsco spatialite=yes foo.sqlite foo.jml
ogr2ogr -f sqlite foo.sqlite foo.jml
ogr2ogr -f gpkg foo.gpkg foo.jml

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?

-Jukka Rahkonen-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180509/aa42de43/attachment-0001.html>


More information about the gdal-dev mailing list