[gdal-dev] COPY statement failed with PG_USE_COPY=YES

Matteo Ghetta matteo.ghetta at gmail.com
Tue Nov 21 00:24:36 PST 2023


Hi all,

I'm trying to import (many) shapefiles into a PG database. I'm facing 
the following error, but only when PG_USE_COPY is set to YES:

ERROR 1: COPY statement failed.
ERROR:  date/time field value out of range: "0000/00/00"
CONTEXT:  COPY TABLE, line 12682, column DATA_INI: "0000/00/00"

The value in the source shapefile is NULL for some rows. With 
PG_USE_COPY NO the import works perfectly.

I've found this old ticket, that seems to describe this exact issue, and 
is marked as resolved:

https://trac.osgeo.org/gdal/ticket/4265

Tested with:

* GDAL 3.2.2, released 2021/03/05
* GDAL 3.7.3, released 2023/10/30

Do you have any ideas about what is causing this?

Cheers and thanks

Matteo


More information about the gdal-dev mailing list