2

I have created a multitable Geopackage as a Database. After some work, I decided to replace one layer with a different layer, so I created a new layer and deleted the old one via the DB-Manager in QGIS 3.22, as described e.g. in this thread.

The deleted table is still visible in the DB-Manager, however, and it also still appears as loadeable when connecting to the Geopackage via the Datasourcemanager. It is only displayed, it does not have any entries or fields, which apparently really where deleted. Since I allready have encountered a couple of bugs in the QGIS-DB-Manager, I wanted to make sure that the table isn't still in the database and opened the GeoPackage in DBeaver. The table was visible in DBeaver as well, so I deleted it again via DROP TABLE. In DBeaver it is gone now but in QGIS it still appears.

I have tried reloading the Geopackage in a new QGIS-Project and deleting and resetting the entire Database connection in the Datasourcemanager, but the table still appears in QGIS.

Is there any other workflow I must follow, to get rid of the layer in QGIS, or is this simply a bug?

2
  • 4
    When SQLite db is in wal mode the changes are stored first into a .wal file. They are written into the main db file at least when all connections are closed and then the .wal file disappears. Keep an eye on the wal file in directory where your geopackage is and repeat your tests.
    – user30184
    Mar 23 at 7:47
  • Thanks for the hint. For some reason the .wal was not deleted upon closing QGIS. Probably this has to do with the linking in DBeaver. Could you turn your comment into the answer, so I can close the thread? Mar 23 at 18:44

1 Answer 1

2

QGIS sets the GeoPackage SQLite database into Write ahead logging (WAL) mode https://sqlite.org/wal.html. Changes that are made into a database from one connection will not exist for the other connections which were open at the time of editing. All the changes are written into the database at least when the last connection is closed. The .wal file disappears by the same. That is also a simple indicator for a user: if .wal file exists there are some changes pending and the database may look a bit different for each open connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.