Bug report #17878

QGIS 3 Vector Layer Fields Garbled when Clicking the Toggle Editing Icon

Added by Calvin Hamilton over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:Alessandro Pasotti
Category:Attribute table
Affected QGIS version:master Regression?:No
Operating System:Windows 7, Linux Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:25773

Description

QGIS Version: 2.99.0-268

Attached is a sample geopackage file. Load the file into QGIS. Open the Attribute Table. Now click on the "Toggle Editing" toolbar icon. Watch the attribute table. For me, the first entry immediately becomes garbled. See the before and after images.

test.gpkg - Sample Data (116 KB) Calvin Hamilton, 2018-01-17 10:07 PM

attribute_table_after.jpg - Attribute Table Before Error (51.7 KB) Calvin Hamilton, 2018-01-17 10:14 PM

attribute_table_before.jpg - Attribute Table After Being Garbled (48.1 KB) Calvin Hamilton, 2018-01-17 10:14 PM

qgis-attrtable-error.png (76.6 KB) Alessandro Pasotti, 2018-01-26 07:17 PM

bad_data.jpg - Garbled table (54 KB) Calvin Hamilton, 2018-01-30 08:11 PM


Related issues

Related to QGIS Application - Bug report #17861: SQLite REAL numbers displayed as too many digits in Attri... Closed 2018-01-15

Associated revisions

Revision ab607ce3
Added by Alessandro Pasotti over 6 years ago

[bugfix] Fix minimum values for range widgets

Fixes #17878 QGIS 3 Vector Layer Fields Garbled when Clicking the Toggle Editing Icon

Revision c50e1bff
Added by Alessandro Pasotti over 6 years ago

[bugfix] Allow precision config for doubles in range widget

Fixes #17878 followup for PR https://github.com/qgis/QGIS/pull/6185

This commit adds a configuration option for precision to
double field types in range widget.

History

#1 Updated by Jérôme Guélat over 6 years ago

I can confirm this issue. And it looks like a regression since it's not happening with QGIS 2.18.15...

#2 Updated by Tom Chadwin over 6 years ago

Confirmed in c91e33d332. Exiting layer edit without saving changes restores the row.

Interestingly, if you then enable editing again (without having closed the attribute table), the corruption does not occur.

#3 Updated by Alessandro Pasotti over 6 years ago

  • Assignee set to Alessandro Pasotti

#4 Updated by Alessandro Pasotti over 6 years ago

one of the root causes is that the form value of the second "double" field is set to NULL, even when editing is disabled (see attachment)

#5 Updated by Alessandro Pasotti over 6 years ago

  • Operating System changed from Windows 7 to Windows 7, Linux
  • Category changed from Vectors to Attribute table
  • Status changed from Open to In Progress
  • Priority changed from Normal to High

Ok, I've probably found the issue with NULLs and I'll commit a patch soon, but I think we have another separate issue here that is the precision of the numeric floating point fields.

It is set to 0 by default that in code is implemented like leave the widget its own default that is 2 decimal positions.

I didn't try very hard, but I've not found an easy way to change it from the layer properties.

Would you mind filing a separate bug to discuss the precision issue?

I'm not sure about what the expected outcome should be, I think it would make sense to have more decimal places by default (like 6) and definitely there must be a way to configure that in the field configuration of the layer properties.

#6 Updated by Calvin Hamilton over 6 years ago

One thing I also have noticed is that when in editing mode, if you select a row from the Attribute Table and click the "Delete selected features" icon, it deletes two rows and not just the selected row. Do you get the same results?

#7 Updated by Alessandro Pasotti over 6 years ago

No, I can't reproduce the delete issue, but please, file a separate ticket for separate problems.

#8 Updated by Alessandro Pasotti over 6 years ago

  • Pull Request or Patch supplied changed from No to Yes

#9 Updated by Anonymous over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#10 Updated by Calvin Hamilton over 6 years ago

  • File bad_data.jpg added
  • Status changed from Closed to Reopened

I just tested this today and it is not quite fixed although the behavior has changed. There are two issues that I see:

1. This is the lesser problem. Right mouse click on the test layer and select "Open Attribute Table". In the window click on the "Toggle editing mode" icon then click it again. Because nothing was changed it shouldn't do anything, but it pops up the windows asking if you want to save it. It shouldn't do that. Interestingly, if you click on the Discard button and the keep clicking on the "Toggle editing mode" button you won't see the dialog box again.

2. For this test make sure you have closed the attribute table and then reopen it. Click on the "Toggle editing mode" icon just once. Now select the "Add Point Feature" icon and click on the map to add a feature. For 'label' I just called it test and left 'latitude' and 'longitude' as NULL. What it does is garbles the data in the first row and the new data is added to line 6 with 'Autogenerate' as the fid. See the attached image. Compare this with the attribute_table_before.jpg image attached with the initial bug report.

#11 Updated by Calvin Hamilton over 6 years ago

Note the example image for problem #2 is bad_data.jpg.

#12 Updated by Alessandro Pasotti over 6 years ago

Yes, I've only fixed one of the series of bugs that you are reporting, which is the NULL issue on negative values (I think you called it "garble").
I've also done another PR for setting the precision on double fields, but that is a separate (but related) issue.
With your last comment you are probably reporting yet another issue.
I'd really prefer to see them in different tickets, or it gets much more difficult to track what has been fixed and what has not and refering to a ticket in the commit will just close it (like it happened when I fixed the NULL issue).
Besides: what exactly do you mean with "garble"? Can you try to be more precise?
There is yet another related PR in the queue that might help with the "dirty" state of the layer: https://github.com/qgis/QGIS/pull/6191

#13 Updated by Calvin Hamilton over 6 years ago

I will open another ticket for the issue #2 and will try to be more precise.

Thanks for all your work on this.

#14 Updated by Calvin Hamilton over 6 years ago

Here is the new ticket #18007

#15 Updated by Anonymous over 6 years ago

  • Status changed from Reopened to Closed

#16 Updated by Alessandro Pasotti over 6 years ago

  • Related to Bug report #17861: SQLite REAL numbers displayed as too many digits in Attribute Table added

#17 Updated by Alessandro Pasotti over 6 years ago

  • Resolution set to fixed/implemented

Please test the latest commits, all tests should be done with a new project because the default widgets for fields have changed.

#18 Updated by Calvin Hamilton over 6 years ago

That seems to have resolved the issue.

Also available in: Atom PDF