0

I am trying to import a shapefile using db manager to postgresql. My shapefile has OBJECTID (PRIMARY KEY), ID (STRING FIELD eg: 2543-96-7948 )and several other attributes of type string. When importing I get the following error.

enter image description here

When I import using postgis shapefile import/export manager, I got no errors and the shapefile uploaded successfully.

I think qgis is assuming my primary key to be ID field when it is actually OBJECTID. How to change this? I tried using the primary key field in input table and set it to id but got same error. Does it create new field or is it selecting a column from the attribute table?

looked up for answers here but was not enough to resolve my issue.

2
  • 2
    You should not set the primary key in input table into id because that is your problem. You have id field in your data with non-unique values. Name primary key into foo or anything else that you do not have in your attributes and the driver should use the objectid.
    – user30184
    Apr 28, 2021 at 6:47
  • yes, that solved the issue. named the primary key to foo and it got imported. Apr 28, 2021 at 7:50

0

Browse other questions tagged or ask your own question.