I am receiving the following error when trying to import a dbf file into PostgreSQL (v 12, pgAdmin 4) using the Boundless/OpenGeo Suite for Mac pgShapeLoader GUI (which was recommended for Mac users in a Stack Exchange answer here, since there is no shapefile importer GUI included in the most recent Mac installation: Shapefile loader in pgAdmin 4):

Failed SQL begins: "CREATE INDEX ON "public"."soildef" USING GIST ("geom");
Failed in pgui_exec(): ERROR:  column "geom" does not exist

Shapefile import failed.

The pgShapeLoader GUI worked fine for me when importing shapefiles, but it is producing the above error for the dbfs. And I know it should work because it is working for everyone using Windows for the PostGIS tutorial I'm following on Udemy (meaning, there is nothing wrong with the dbf itself).

The Windows installation of PostgreSQL/PostGIS has a shapefile loader gui shp2pgsql-gui.exe, but unfortunately this does not appear to be included in the Mac install. There is only a Unix executable shp2pgsql in the bin folder.

Are my only options for importing the dbfs to use the command line and/or to do this through QGIS, per another answer on the linked SE question/answer above? I am not finding any other solutions. Or maybe the question I should really be asking myself is simply: "How do you import a dbf into PostgreSQL on a Mac?" (Which seems a bit obvious now that I'm typing it, but I'd like to post this question anyway for anyone else who might run into this problem).

  • It's unclear from your question if these dBase files are just that, standalone dBase files, or whether they are associated with the shapefiles themselves. The .dbf data is part of the shapefile standard, so any shapefile loader should automatically include the attributes with geometry.
    – Vince
    Nov 10 '19 at 16:53
  • @Vince Ah. Didn't catch that ambiguity. They are standalone files, not part of the shapefiles.
    – Kristen G.
    Nov 10 '19 at 17:22
  • dbf does not contain the geom? then it will need to be created - the error you see states 'geom' does not exist - look in your soildef table - you will need to create geom to create a GIST index.
    – Mapperz
    Nov 10 '19 at 17:32
  • @Mapperz Right, I would have thought the same, but the instructor manages to import the DBFs using the GUI without a problem. All of our inputs are the same. Only difference is he's using windows. Why wouldn't he get the same error message then?
    – Kristen G.
    Nov 10 '19 at 17:36
  • see gis.stackexchange.com/questions/11886/…
    – Mapperz
    Nov 10 '19 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.