Jukka, I highly suspect that the ALTER TABLE must imply a rewriting of the file by spatialite/spatialite-gui, and when doing so, it doesn't preserve the "application id" (4 bytes in the header of sqlite file), that geopackage specification mentions to be set to a particular value. Consequently the geopackage driver later fails when checking the signature.
A few inline comments below > Hi, > > There are no GUI-tools for managing GeoPackage databases at the moment and > because after all they are only SQLite db files just like Spatialite files I > thought it would be a good idea to do some maintenance work for GPKG > database with Spatialite-gui. > > I could do a few things with Spatialite-gui without troubles: create a view, > create an index, add column. But then I renamed one table and after that I > cannot use the DB file with GPKG driver any more. SQLite driver does open it > but db is unusable because the geometry BLOBs are different. I have received > two king of error messages from ogrinfo and also a sudden program crash. One > error message is: > > ogrinfo test.gpkg > ERROR 1: bad application_id on 'test.gpkg' > ERROR 1: bad application_id on 'test.gpkg' > FAILURE: > Unable to open datasource `test.gpkg' with the following drivers. Yes, that's expected if the application id has been changed. That one doesn't cause a program crash, right ? > > Another message is: > ogrinfo test.gpkg > ERROR 1: (null) > INFO: Open of `test.gpkg' > using driver `GPKG' successful. --> Hum, "ERROR 1: (null)" means a NULL pointer used as a string somewhere and a potential source for crashing. > > To reproduce the error create a GeoPackage with GDAL, open it with > Spatialite-gui and rename one table. I know it is perhaps not a good idea to > rename a GeoPackage table with "ALTER TABLE ... RENAME TO ..." because it > breaks the integrity, but on the other hand, because it seems to be possible > to do so without any triggers and constraints preventing the operation and > the result is an unusable database it could be worth having a look on what > happens. > > -Jukka Rahkonen- > > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
