Bug report #6279
ERROR: duplicate key value violates unique constraint...
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Giuseppe Sucameli | ||
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 #: | 15579 |
Description
When importing a vector into PostGIS with DB manager, if the original vector has already a column "id" then the tool will give
Creation error for features from #0 to #0. Provider errors was:
PostGIS error while adding features: ERROR: duplicate key value
violates unique constraint "table_name_pkey"
DETAIL: Key (id)=(0) already exists.
As "id" is very common (unless the old "gid") I guess that a check should be added before trying to import the vector.
Associated revisions
dbmanager: avoid duplicate field error (fix #6279)
History
#1 Updated by Paolo Cavallini about 12 years ago
- Target version set to Version 2.0.0
#2 Updated by Giuseppe Sucameli almost 12 years ago
- Status changed from Open to Closed
Fixed in changeset 0239795d7931b614be22e87d12beecf20372b5c6.
#3 Updated by Giuseppe Sucameli almost 12 years ago
Now the new field name is not passed from DBManager to the provider unless the user tick the "primary key" checkbox.
The provider checks the field name list and chooses a different name whether the default one (i.e. "id") exists yet.
#4 Updated by Giuseppe Sucameli almost 12 years ago
- Resolution set to fixed
Fixed for QGis Friendly Courses http://www.qgis.org/en/sponsorship/qgis-friendly-courses.html