Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#1338 closed bug (fixed)

nextval values of a postgis layer are not saved

Reported by: cmoe Owned by: nobody
Priority: critical: causes crash or data corruption Milestone:
Component: Data Provider Version: Trunk
Keywords: Postgis default values Cc: cedric.moeri@…
Must Fix for Release: Yes Platform: RedHat
Platform Version: Awaiting user input: no

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.

Change History (2)

comment:1 by jef, 16 years ago

Resolution: fixed
Status: newclosed

fixed in r9450

comment:2 by (none), 15 years ago

Milestone: Version 1.0.0

Milestone Version 1.0.0 deleted

Note: See TracTickets for help on using tickets.