Bug report #12386
NOT NULL problem on PostGIS tables
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Data Provider/PostGIS | ||
Affected QGIS version: | 2.8.1 | Regression?: | No |
Operating System: | windows/ubuntu | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 20560 |
Description
Hi.
I have a problem with not null serial field in QGIS 2.8 on Windows (7/8) and Linux (Ubuntu 12.04).
Database is PostgreSQL 9.3 with PostGIS 2 on that Ubuntu.
If I create table like:
CREATE TABLE null_test ( gid serial NOT NULL, id serial NOT NULL, aaa text, bbb text, ccc real, the_geom geometry(Geometry,2177), CONSTRAINT null_test_pkey PRIMARY KEY (gid), CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'LINESTRING'::text OR the_geom IS NULL) );
and load it in QGIS (as a postgres user) I wont be able to add any object because of id NOT NULL constraint. When I add a new feature QGIS shows in Feature Attributes
nextval(‘null_test_id_seq’::regclass)
in id
field (as for gid
) but while saving says: Could not commit changes to layer null_test Errors: ERROR: 1 feature(s) not added. Provider errors: PostGIS error while adding features: ERROR: null value in column "id" violates not-null constraint Failing row contains (4, null, null, null, null, 00B3...)
I've notes also that if I delete primary key constraint from gid QGIS 2.8 won't be able to get new value from gid sequence and display the same kind of error for gid field.
The same table ‘null_test’ loaded in QGIS 2.6 works fine.
I have attached some printscreen to show what I mean.
Can you help?
Cheers!
Related issues
Associated revisions
History
#1 Updated by Seb Radzimski almost 10 years ago
- Assignee deleted (
Jürgen Fischer)
#2 Updated by Jürgen Fischer almost 10 years ago
- Status changed from Open to Closed
Fixed in changeset bfb8ab6893d5bf77b4ae92c6c90e0b5b9c7e9ae7.