I am trying to load a shapefile into a PostGIS instance using
ogr2ogr. I am getting an odd error that I think might have to do with the specific version of PostGIS that we are using.
In order to debug what
ogr2ogr is trying to do I would like to see the sql query that is generated behind the scenes.
I believe that Getting query output from ogr2ogr? is trying to get at the same thing. Like this OP, I am interested in reproducing the functionality available with shp2pgsql, which produces the create and insert statements as outputs with:
shp2pgsql -s 4326 shapefile.shp geodata_tablename > statements.sql
statements.sql then contains the create table statements that were used as well as the individual insert statements.