<div dir="ltr"><div><div><div><div>Hello<br><br></div>We have a pb with copy/paste from a shapefile to postgis if the primary key is a string.<br></div>The primary key is left NULL and no commit is possible.<br><br></div>To reproduce the pb :<br>
<br>Create <b>table1 </b>with a string primary key <br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace"><font>CREATE TABLE table1</font></span><br>
<span style="font-family:courier new,monospace"><font>(</font></span><br><span style="font-family:courier new,monospace"><font>  f1 character varying(10) NOT NULL,</font></span><br><span style="font-family:courier new,monospace"><font>  f2 character varying(10),</font></span><br>
<span style="font-family:courier new,monospace"><font>  geom geometry,</font></span><br><span style="font-family:courier new,monospace"><font>  <b>CONSTRAINT t1_pkey PRIMARY KEY (f1),</b></font></span><br><span style="font-family:courier new,monospace"><font>  CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),</font></span><br>
<span style="font-family:courier new,monospace"><font>  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POINT'::text),</font></span><br><span style="font-family:courier new,monospace"><font>  CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 2154)</font></span><br>
<span style="font-family:courier new,monospace"><font>)</font></span><br><span style="font-family:courier new,monospace"></span></blockquote><span style="font-family:courier new,monospace"><br></span><b>table2</b> is the same as table 1 but it has no primary key<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">CREATE TABLE table2</span><br><span style="font-family:courier new,monospace">(</span><br>
<span style="font-family:courier new,monospace">  f1 character varying(10) NOT NULL,</span><br><span style="font-family:courier new,monospace">  f2 character varying(10),</span><br><span style="font-family:courier new,monospace">  geom geometry,</span><br>
<span style="font-family:courier new,monospace">  CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),</span><br><span style="font-family:courier new,monospace">  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POINT'::text),</span><br>
<span style="font-family:courier new,monospace">  CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 2154)</span><br><span style="font-family:courier new,monospace">)</span><br><span style="font-family:courier new,monospace"></span></blockquote>
<br><b>shapes.shp</b> is a shapefile that contains the points I would like to copy/paste in the Postgis tables<br>(see attached zip file)<br><br>1) if I copy/paste the points from shapes.shp to table1, the key field stays NULL and the commit is impossible.<br>
2) if I copy/paste the points from shapes.shp to table2, everything is ok.<br><br></div><div>Have you ever seen this bug?<br><br></div><div>Thanks<br><br></div><div>Fabrice<br></div><div><br><br></div></div>