[postgis-users] Problem with date fields in shp2pgsql

Michael Fuhr mike at fuhr.org
Sat Sep 9 07:37:14 PDT 2006


On Sat, Sep 09, 2006 at 08:12:13AM -0600, Michael Fuhr wrote:
> DBFIsAttributeNULL() in loader/dbfopen.c recognizes only "00000000"
> as a NULL date; I'm guessing your shapefile has blanks (0x20) instead
> of zeros (0x30).

Clarification: the data would be in the .dbf file.  I can reproduce
the behavior you're seeing if I use pgsql2shp to dump a table with
a NULL date, then use a binary editor on the .dbf file to change
the zeros in the date column to blanks, then use shp2pgsql to read
the data.  Adding a strlen() check to DBFIsAttributeNULL() causes
shp2pgsql to output NULL instead of ''.

-- 
Michael Fuhr



More information about the postgis-users mailing list