[QGIS-Developer] GeoPackage foreign key constraint checks

Matthias Kuhn matthias at opengis.ch
Fri May 8 03:33:22 PDT 2020


Hi Alessandro,

Thanks for pointing that out.

On 5/8/20 11:51 AM, Alessandro Pasotti wrote:
>
> On Fri, May 8, 2020 at 11:30 AM Matthias Kuhn <matthias at opengis.ch 
> <mailto:matthias at opengis.ch>> wrote:
>
>     Hi list,
>
>     I wondered about the state of GeoPackage. Personally, cince it has
>     been introduced to qgis and evenmore since it has been selected as
>     the default format, I have never grown to fully and completely.
>
>     I do not want to trigger a evangelical discussion here. I'd like
>     to see where we are and what we can reasonably do to have a
>     default file format which can be recommended with no bad feelings.
>
>
>
> Thanks for starting this discussions, we clearly need a path forward.
>
> I just added a note on one of the topics (and cut the rest):
> [...]
>
>     * The couple of corrupted files I have received over the years
>     which could only be repaired by a command line "dump contents as
>     sql and execute into new file"
>
>       I have not found a way to reproduce this. Some of them were
>     produced by older qgis versions making it easy to violate foreign
>     key constraints and hard to recover. This has been fixed.
>
>       Possible mitigation: offer a "repair" option in qgis. Through
>     processing or "on the fly" upon detection.
>
>
> If I'm not mistaken, the fix was to disable foreign key constraints 
> altogether for the whole QGIS application for all GPKGs, no questions 
> asked.


The old situation was: it's possible to change a value without checks. 
It's not allowed to open a broken gpkg. I.e. easy to break, impossible 
to recover.

The new situation is: It's possible to open a broken gpkg, so it's 
possible to recover).

There may be space for further improvements on the "editing" side. This 
needs to be carefully tested (i.e. make sure it plays well with deferred 
checks, like on postgres, and incomplete transactions are fully rolled 
back without entering into a broken state of gpkg again).

Bests

Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200508/bb14a1ae/attachment-0001.html>


More information about the QGIS-Developer mailing list