Bug report #5642
return a more meaningful error when column name is duplicated
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | DB Manager | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 15205 |
Description
The attached shapefile does not gives any particular problem (except encondig) when loading it into postgis using ogr2ogr, shp2pgsql, spit and postgis manager, but with db manager it always fails with
@Error 7
Feature write errors:
Creation error for features from #0 to #199. Provider errors was:
PostGIS error while adding features: ERROR: duplicate key value violates unique constraint "alt4_pkey"
Only 1 of 201 features written.@
History
#1 Updated by Giovanni Manghi over 12 years ago
- Assignee changed from Giovanni Manghi to Giuseppe Sucameli
#2 Updated by Giovanni Manghi over 12 years ago
- Subject changed from shapefiles doesn't load using db manager (but works with spit, postgis manager and cli) to return a more meaningful error when column name is duplicated
it works if I check the "primary key" checkbox and change it to something else then "id", that in fact is a column name already there in the original shapefile.
Why db manager chooses to give by default the postgis id as "id" and not "gid" as usual?
Same thing for the geometry column, why "geom" instead "the_geom"?
#3 Updated by Giuseppe Sucameli almost 12 years ago
I cannot change the error message: that's the string retured by the DBMS and then the provider.
What I can do is to change the default pk and geometry fields' name.
#4 Updated by Giovanni Manghi almost 12 years ago
Giuseppe Sucameli wrote:
I cannot change the error message: that's the string retured by the DBMS and then the provider.
What I can do is to change the default pk and geometry fields' name.
gid is (was) a good choice, but why not adding a check before importing the vector, and if the case throw and error like "the column XXX already exist".
#5 Updated by Giovanni Manghi almost 12 years ago
- Affected QGIS version set to master
- Crashes QGIS or corrupts data set to No
- Project changed from 27 to QGIS Application
#6 Updated by Giovanni Manghi almost 12 years ago
- Category set to DB Manager
#7 Updated by Giovanni Manghi almost 12 years ago
- Assignee deleted (
Giuseppe Sucameli)
#8 Updated by Giovanni Manghi over 11 years ago
- Resolution set to fixed
- Status changed from Open to Closed