[Qgis-user] QGis 2.0 Copy/Paste issue with explicit primary keys

F T oukile at gmail.com
Mon Feb 3 00:58:49 PST 2014


Hello

We often use copy/paste from a shapefile to postgis  with explicit primary
keys (ie PostgreSQL primary key is not a serial but an explicit string or
integer).

With QGis 1.7.4, those copy / paste where possible.

QGis 2.0 brings a regression.
During the copy / paste, QGis 2.0 puts the primary keys values  to NULL and
no commit is possible.

To reproduce the pb :

Create *table1 *with a string primary key

    CREATE TABLE table1
>     (
>       f1 character varying(10) NOT NULL,
>       f2 character varying(10),
>       geom geometry,
>       *CONSTRAINT t1_pkey PRIMARY KEY (f1),*
>       CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
>       CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) =
> 'POINT'::text),
>       CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 2154)
>     )
>     WITH (OIDS=TRUE);
>


*table2 *is the same as table 1 but it has no primary key

    CREATE TABLE table2
>     (
>       f1 character varying(10) NOT NULL,
>       f2 character varying(10),
>       geom geometry,
>       CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
>       CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) =
> 'POINT'::text),
>       CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 2154)
>     )
>     WITH (OIDS=TRUE);
>

*shapes.shp* is a shapefile that contains the points I would like to
copy/paste in the Postgis tables
(see attached zip file)

Have you ever seen this problem?

Thanks

Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140203/67bd9d92/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shapes.zip
Type: application/zip
Size: 1357 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140203/67bd9d92/attachment.zip>


More information about the Qgis-user mailing list