Bug report #13183

QGIS Version 2.10 32bit: using Spatialite database table with multiple primary keys.

Added by Terrell Beesley over 8 years ago. Updated about 5 years ago.

Affected QGIS version:2.10.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:21245


When linking a Spatialite database table with two columns as primary key to QGIS 2.10, strange things happen.
Adding a record(s) using "add feature" in editing mode, it enters 'ERROR' in the fields that were added. After saving and reloading the table, the new records are no longer null.
Adding a column using "new column" in editing mode, all the record fields change to 'ERROR' except for the first record. After saving the table, all the records disappear. Closing and reopening the table brings them all back, including the new column.
It also has python code issues using dataProvider() to access records.

After reviewing bug report 8636, I changed the primary key fields to TEXT type, but this didn't make a difference.

To test this I used a new spatialite database (test.sqlite) and adding a single table (testPrimaryKeys) with three fields (id1, id2, field).

test.sqlite - Database used to test issues. (4.75 MB) Terrell Beesley, 2015-08-04 01:05 PM


#1 Updated by Jukka Rahkonen over 8 years ago

I can reproduce the behaviour. For example, adding a new record shows just ERRORs in QGIS but having a look at the database with spatialite-gui once the changes have been saved shows that a new row was inserted right.

However, I think that using composite primary keys in GIS context is a bad idea, at least if system should support also inserts. So should the fix be to make QGIS to accept such layers just as read-only? Or perhaps mention the limitation in the documentation.

#2 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#3 Updated by Jürgen Fischer over 6 years ago

  • Category set to Unknown

#4 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

End of life notice: QGIS 2.18 LTR


QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.

We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4

Most plugins have been either migrated or incorporated into the core QGIS code base.

We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.

You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.

If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.

The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.

Also available in: Atom PDF