[postgis-users] Debugging shp2pgsql inserts

andy andy at squeakycode.net
Fri Jul 19 10:54:48 PDT 2013


On 7/19/2013 12:43 PM, Travis Kirstine wrote:
> I've been attempting to import a large shapefile into postgis and I keep
> running into "ERROR:  current transaction is aborted, commands ignored
> until end of transaction block" when importing the data.
>
>   Is there a easy method to determine which INSERT causes the
> transaction to fail? It appears the only why is to catch the stdout as
> soon as psql errors
>
> shp2pgsql -I -W LATIN1 -s 3857 mybigshp.shp mytbl > mysql.sql
>
> psql -U user -o log.txt mydb < mysql.sql
>
> Thanks
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>

In your psql step, use:

psql -v ON_ERROR_STOP=1 -U user -o log.txt mydb < mysql.sql


More good options here:
http://petereisentraut.blogspot.com/2010/03/running-sql-scripts-with-psql.html

-Andy


More information about the postgis-users mailing list