I am trying to load a bunch of vectors and rasters in a geopackage file. I was able to load few vectors but then all of a sudden the following warning popped up preventing me to load any more vectors:

Failed to import some vector layers!
Opening of data source in update mode failed (OGR: pragma foreign_key_check on 'F:/link/to/my/geopackage.gpkg' failed. You can disable this check by setting the OGR_GPKG_FOREIGN_KEY_CHECK configuration option to NO)

I couldn't find a way to set that configuration or to manually override it.

How can I overcome this issue that prevents me from loading any more vector files?

  • 1
    Instead of disabling the foreign key check you should try to find out why there is a conflict with foreign keys and fix the error.
    – user30184
    Nov 11, 2019 at 8:16
  • 1
    please don't use pictures of error messages, it is easy to copy and paste the error text.
    – Ian Turton
    Nov 11, 2019 at 8:36
  • 1
    I think I'd be able to answer this question "on-topic", so I'd like to vote to reopen it. There was a discussion about this recently on the qgis dev list osgeo-org.1560.x6.nabble.com/… Nov 11, 2019 at 12:21
  • Thanks Matthias, I did read your post a while ago. However, I couldn't figure out neither what the problem was with the rest of my vectors, nor how to implement the fix explained in your post.
    – Overlord84
    Nov 11, 2019 at 23:11
  • @IanTurton -> Can you please explain why even after the image has been replaced with text, the post has been closed? Thank you
    – Overlord84
    Nov 17, 2019 at 1:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.