[Qgis-developer] problem with the postgis provider
Andreas Neumann
a.neumann at carto.net
Wed Jun 23 07:09:05 EDT 2010
Hi Lionel,
If you define a column as a primary key, you don't need to define it as
unique as well. A primary key is unique per definition - so the unique
constraint is redundant.
Of course QGIS should still handle this properly. I also had some issues
with views and primary key detection ...
Andreas
On Wed, June 23, 2010 9:36 am, Lionel Roubeyrie wrote:
> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Andreas Neumann
http://www.carto.net/neumann/
http://www.svgopen.org/
More information about the Qgis-developer
mailing list