1

I'm importing some MapInfo tab files into a PostgreSQL database running the following command in FWTools Shell:

ogr2ogr -f "PostgreSQL" PG:"dbname='<the_database>' host='<the_host>' port='5432' user='<the_username>' password='<the_password>'" -lco SCHEMA=<the_schema> -lco PRECISION=NO -nlt GEOMETRY -t_srs EPSG:25832 C:\<the_local_path>\file.tab

Some of the files run through just fine, but some of the files have date values like that 0000/00/00 0:00:00 which ogr2ogr, justifiably, cannot interpret.

ERROR 1: INSERT command for new feature failed.
ERROR:  date/time field value out of range: "0000/00/00  0:00:00"
LINE 1: ...ning', 'Tilslutning af stik', 'I brug/drift', '', '0000/00/0...

Is there a flag which will make ogr2ogr ignore those, and just insert a null?

  • 2
    FWTools is very old GDAL 1.7.0b2, FWTools 2.4.7, released 2010/01/19. It is OK to use FWTools but if you find any trouble with it the first thing to do is to forget FWTools and retry with new GDAL version. You can still read gdal.org/ogr2ogr.html and try the effect of -skipfailures. – user30184 Sep 16 '15 at 9:37
  • 1
    @user30184 thanks. Using GDAL instead of FWTools fixed my problem. – Ambran Sep 16 '15 at 13:41

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.