[postgis-users] shp2pgsql - bad date formats

Jeff Dege jeff.dege at korterra.com
Thu Apr 14 10:56:33 PDT 2011


I'm trying to load a shapefile into a PostGIS database, using shp2pgsql and psql.

It's failing because a couple of the sql insert statements have date fields containing '0'.

ERROR:  date/time field value out of range: "0"
HINT:  Perhaps you need a different "datestyle" setting.

What I need is for these features to be inserted with NULL date fields, instead of '0'.

Currently, I'm running psql on the generated .sql file, capturing the output.  I then search the output to identify the problem statement, delete it from the generated file, and then run psql on it again, until there are no errors.  I save the lines I deleted in another file, and then hand-edit them, and insert them separately.

This is tiresome, tedious, and slow.

Anyone have any better ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110414/8e73a018/attachment.html>


More information about the postgis-users mailing list