[Qgis-developer] problem with the postgis provider

Lionel Roubeyrie lionel.roubeyrie at gmail.com
Wed Jun 23 03:36:07 EDT 2010


Hi all,
Seems there is a problem with the checks made by the postgis provider
and views, because it complains about missing uniques int4 values when
we put a unique constraint on the gid::int4 primary key, and all goes
fine if we drop the constraint Oo. Here is a example, made on 2
postgis servers :

Table :
CREATE TABLE spatial.commune
(
  code_insee character varying(5),
  region character varying(20),
  the_geom geometry,
  gid serial NOT NULL,
  CONSTRAINT commune_pkey PRIMARY KEY (gid),
  CONSTRAINT unique_gid UNIQUE (gid),
  CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 2154)
)

View creation:
CREATE VIEW test AS
SELECT * FROM spatial.commune

Calling the view doesn't work, unless the unique_gid constraint is dropped.
Tested with postgresql 8.4.2 and 8.4.4 with postgis 1.5, QGIS 1.5 on
Ubuntu 10.04

Cheers

-- 
Lionel Roubeyrie
lionel.roubeyrie at gmail.com
http://youarealegend.blogspot.com


More information about the Qgis-developer mailing list