Bug report #1338

nextval values of a postgis layer are not saved

Added by cmoe - about 16 years ago. Updated about 15 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:RedHat Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11398

Description

I'm trying to edit a postgis table (feature type point) like the following:

CREATE TABLE avt_oev_haltestellen
(
  ogc_fid integer NOT NULL DEFAULT nextval(('"avt_oev_haltestelle_ogc_fid_seq"'::text)::regclass), -- OGC Feature ID
  wkb_geometry geometry, -- OGC WKB Geometrie
  haltest_id integer NOT NULL DEFAULT nextval(('"avt_oev_haltest_id_seq"'::text)::regclass),
  anzahl_hs integer,
  new_date date DEFAULT ('now'::text)::date, 
  archive_date date DEFAULT '9999-01-01'::date, 
  archive integer DEFAULT 0, 
  CONSTRAINT avt_oev_haltestellen_pkey PRIMARY KEY (ogc_fid),
  CONSTRAINT haltest_id_unique UNIQUE (haltest_id),
  CONSTRAINT "$1" CHECK (srid(wkb_geometry) = (-1)),
  CONSTRAINT "$2" CHECK (geometrytype(wkb_geometry) = 'POINT'::text OR wkb_geometry IS NULL)
)

If I add a point the enter attribute values dialog pops up, with all the default values written in the fields. If I try to save it now, qgis/postgis answers that 'ERROR: null value in column "haltest_id" violates not-null constraint'. If I overwrite the nextval command/function of this fields with a number it works. Seems like the nextval only is working for the primary key. The other defaults in the example work.

Associated revisions

Revision e0663b46
Added by Jürgen Fischer about 16 years ago

fix #1338

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9450 c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 438dd760
Added by Jürgen Fischer about 16 years ago

fix #1338

git-svn-id: http://svn.osgeo.org/qgis/trunk@9450 c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Jürgen Fischer about 16 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

fixed in 438dd760 (SVN r9451)

#2 Updated by Anonymous about 15 years ago

Milestone Version 1.0.0 deleted

Also available in: Atom PDF