Bug report #16785

Constraint prevent adding feature to spatialite layer with auto-increment pkey

Added by Denis Rouzaud over 3 years ago. Updated almost 3 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Edit widget
Affected QGIS version:master Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:24684

Description

1. Create a spatialite layer with an auto-incrementing primary key
2. Turn editing on
3. Add feature
=> the pkuid field is invalid with a NULL value but you cannot edit it.

Screenshot from 2017-07-04 07-22-25.png (16.7 KB) Denis Rouzaud, 2017-07-04 07:26 AM

2.PNG - after edit (7.72 KB) Darek Bobak, 2017-07-05 12:14 PM

1.PNG - before edit (11.4 KB) Darek Bobak, 2017-07-05 12:14 PM

field_properties.png (74.1 KB) Darek Bobak, 2017-07-05 12:36 PM

History

#1 Updated by Denis Rouzaud over 3 years ago

#2 Updated by Darek Bobak over 3 years ago

It is possible to add pkuid manualy (QGIS master on Windows 10). But, QGIS does not add it automatically, which is definitely undesirable behaviour

#3 Updated by Denis Rouzaud over 3 years ago

On my side, I can't validate the form, see the attached screenshot (apply is disabled).

#4 Updated by Darek Bobak over 3 years ago

Did you try to manually write something in the pkuid field? And check, if the field properties allow edition of the field (see attached image).
In the meantime, I've found the way to make QGIS automatically fill that field with increment value. You have to insert and expression:

$id

in the "Default value" field in the properties of the field.

#5 Updated by Denis Rouzaud over 3 years ago

nope, but if it's the solution, it should be done automatically!

#6 Updated by Darek Bobak over 3 years ago

I agree.

#7 Updated by Giovanni Manghi over 3 years ago

  • Status changed from Open to Feedback

does this affect only master/qgis3, correct?

#8 Updated by Denis Rouzaud over 3 years ago

Yes Master.
But why feedback? For me it's a serious blocker.

#9 Updated by Giovanni Manghi over 3 years ago

  • Status changed from Feedback to Open

Denis Rouzaud wrote:

Yes Master.
But why feedback? For me it's a serious blocker.

the status does not indicates the seriousness: feedback just means that the ticket is open and a question awaiting an answer has been posted. Seriousness is give by the priority field, and by the "regression" field.

#10 Updated by Denis Rouzaud almost 3 years ago

  • Status changed from Open to Closed

fixed in 73674e8157925df6979485cf36804c6e252d03a1

#11 Updated by Giovanni Manghi almost 3 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF