Bug report #8976

Offline Editor not retaining key integer values (or if it retains it does not synchronize correctly)

Added by Zachary Lancaster about 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:C++ Plugins
Affected QGIS version:2.0.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:17637

Description

When converting a project to be edited offline the plugin does not copy or retain primary key or foreign key values. This is creating a large number of null fields. The lack of these key values mean that the data cannot currently be merged back to the original source.

This bug is affecting the current version of plugin for QGIS 2.0.1

Bug Reproduction:
(1)Connect to PostGIS database
(2)Convert to Offline project using Offline Editing Plugin
(3)Open attributes table primary key field will be NULL
(4)Make a change
(5)Synchronize data
(6)Due to the lack of primary identifiers no updates will be committed

offline_1_8.png - Here we can see the offline plugin working in 1.8. Here all integer key values are retained in the offline sqlite database (stx_small_streetnodes(offline)) and the id value is consistent between the offline and online instance. In this case data can chang (86.8 KB) Zachary Lancaster, 2013-11-01 11:35 AM

offline_2_0_1.png - Here we can see the offline plugin working in 2.0.1. Here all integer key values are missing and those fields are listed as NULL. All primary and foreign key values are NULL. In this case changes could be made but these changes cannot be synchronized with (134 KB) Zachary Lancaster, 2013-11-01 11:35 AM

History

#1 Updated by Giovanni Manghi about 6 years ago

  • Category set to C++ Plugins
  • Status changed from Open to Feedback
  • Target version set to Future Release - High Priority

I just tested here and regarding your report it seems to work as expected.

By the way, when off-line it is expected the user to manually fill the primary key field?

#2 Updated by Zachary Lancaster about 6 years ago

It can not be expected that primary key values be filled by the user. The reintegration of the data relies heavily on the correct use of these primary key values. The retention of primary keys did work in 1.8 and allowed for data to be synced back to the online database.

If we look at the images attached we will see that all integer values (in this case keys) are not being retained by the offline database. This leads me to believe that all integer values are not being retained in the offline version of the database.

#3 Updated by Giovanni Manghi about 6 years ago

Hi, this is weird. I'm on Linux and for me the primary are retained correctly in the off-line DB.

Anyway I would consider the lack of an autofill function for the primary key when off-line a regression.

This tools was working ok on qgis 1.7.4, as far as I know it was not working (for other reasons) on 1.8, see

#6146

it was ok for you on 1.8?

What OS are you using?

#4 Updated by Giovanni Manghi about 6 years ago

  • Subject changed from Offline Editor not retaining key integer values to Offline Editor not retaining key integer values (or if it retains it does not synchronize correctly)
  • Status changed from Feedback to Open
  • Priority changed from Normal to Severe/Regression

Anyway I tested 1.7.4 and it was working correctly. In the off line table the primary key field was supposed to be left untouched and then the plugin took care to fill it correctly when synchronizing back. This does not happens now in master.

#5 Updated by Martin Dobias almost 6 years ago

  • Status changed from Open to Feedback

When I convert a layer to offline project, the primary key is preserved and I can keep update attributes.

Maybe a short SQL dump of your table would help (create table + few inserts).

#6 Updated by Giovanni Manghi almost 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed

Martin Dobias wrote:

When I convert a layer to offline project, the primary key is preserved and I can keep update attributes.

Maybe a short SQL dump of your table would help (create table + few inserts).

I just compiled the latest code and it works as expected. Please reopen if necessary.

Also available in: Atom PDF