I'm trying to use PostGIS Shapefile Import/Export Manager to import a shapefile that was created in QGIS. The shapefile has all the blocks of the 2010 U.S. Census for Oregon and was exported as a polygon from a TIGER database that came from the U.S. Census website.
I was having one problem with the shapefile not importing and fixed that with the first answer from this question, i.e. I needed to create a postgis extension in the PostgreSQL database I wanted to work in.
Now, I get a new error when I click on "Import". I get the following error message:
Importing with configuration: or_census_popdens, public, , D:\data\data\PostgreSQL\data\OR_census_popdens.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=4326
Shapefile type: Polygon
PostGIS type: MULTIPOLYGON[2]
Failed in pgui_copy_start(): ERROR: syntax error at or near ")"
LINE 1: ...","area_ha","popdens_ha","area_sqmi","popd_sqmi", ) FROM std...
^
Shapefile import failed.
It seems there is some kind of end of file problem with the attribute table? In the attribute table itself, "popd_sqmi" is the final column, but the code for the error shows a "," trailing that column and just before the closing ")" in the command . I don't know exactly what is causing this error though. How should I fix this?
shp2pgsql -I -s SRDI "SHPname.shp" public.tbname | psql -U <postresql_username> -d <postgis_databae>;
or could you share the link to your .shp file?