Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return a more meaningful error when column name is duplicated #15205

Closed
qgib opened this issue May 25, 2012 · 8 comments
Closed

return a more meaningful error when column name is duplicated #15205

qgib opened this issue May 25, 2012 · 8 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin High Priority

Comments

@qgib
Copy link
Contributor

qgib commented May 25, 2012

Author Name: Giovanni Manghi (@gioman)
Original Redmine Issue: 5642
Affected QGIS version: master
Redmine category:db_manager


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 #10258. Provider errors was:
PostGIS error while adding features: ERROR: duplicate key value violates unique constraint "alt4_pkey"

Only 1 of 201 features written.@


@qgib
Copy link
Contributor Author

qgib commented May 25, 2012

Author Name: Giovanni Manghi (@gioman)


  • assigned_to_id was changed from Giovanni Manghi to Giuseppe Sucameli

@qgib
Copy link
Contributor Author

qgib commented May 25, 2012

Author Name: Giovanni Manghi (@gioman)


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"?


  • subject was 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

@qgib
Copy link
Contributor Author

qgib commented Dec 9, 2012

Author Name: Giuseppe Sucameli (@brushtyler)


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.

@qgib
Copy link
Contributor Author

qgib commented Dec 10, 2012

Author Name: Giovanni Manghi (@gioman)


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".

@qgib
Copy link
Contributor Author

qgib commented Jan 18, 2013

Author Name: Giovanni Manghi (@gioman)


  • version was configured as master
  • crashes_corrupts_data was configured as 0
  • project_id was changed from 27 to 17

@qgib
Copy link
Contributor Author

qgib commented Jan 18, 2013

Author Name: Giovanni Manghi (@gioman)


  • category_id was configured as DB Manager

@qgib
Copy link
Contributor Author

qgib commented Jan 18, 2013

Author Name: Giovanni Manghi (@gioman)


  • assigned_to_id removed Giuseppe Sucameli

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2013

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed
  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority DB Manager Relating to the DB Manager core plugin labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin High Priority
Projects
None yet
Development

No branches or pull requests

1 participant