Bug report #11265

0 used instead of NULL

Added by l h_ over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Digitising
Affected QGIS version:2.4.0 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 #:19564

Description

We just moved back to version 2.2 because we have problems with the digitising of PostGIS-Layer with an integer foreign key. The foreign key has no "not null"-constraint. When we edit it and leave it empty the following message pops up:

Provider errors:
PostGIS error while changing attributes: ERROR: insert or update on table "layer" violates foreign key constraint "fk_layer_group"
DETAIL: Key (fk_layer_group=(0) is not present in table "layer_group".

I guess its a bug with the null values for the attributes.

History

#1 Updated by Matthias Kuhn over 9 years ago

  • Status changed from Open to Feedback

- Which editor widget is configured for the field (vector layer properties /fields tab)?
- How are you editing the attribute? (Feature form, attribute table...)

Some similar bugs have recently been fixed, so this may already be solved in current master. It would be great if you could verify on the latest nightly releases if this is still an issue so it can be resolved for 2.6.

#2 Updated by Matthias Kuhn over 9 years ago

  • Subject changed from Foreign Key to 0 used instead of NULL

#3 Updated by l h_ over 9 years ago

Ok - I tested it in the nightly build and its ok there.

In QGIS 2.4 I edited the feature in the attribute table and the feature form. I didn't configure any editor widget for that field - its just the default one.

#4 Updated by Denis Rouzaud over 9 years ago

IIRC, this bug was fixed in aa40d61a8c5ea8087b6ac51d239c454cb8cf0d7f and b357a666524c207917cf2f0c9ee991eaef5b09f5, on july 30th, so for version 2.5.
This bug was affecting all prior versions including 2.2.

#5 Updated by Giovanni Manghi over 9 years ago

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

Also available in: Atom PDF