[postgis-users] Problem with date fields in shp2pgsql

Paul Ramsey pramsey at refractions.net
Sat Sep 9 09:41:34 PDT 2006


I've committed this change, it seems like fair behavior.
P

On 9-Sep-06, at 7:12 AM, Michael Fuhr wrote:

> On Fri, Sep 08, 2006 at 04:20:26PM -0600, Bruce Rindahl wrote:
>> I am converting a shapefile to PostGIS where one of the fields is  
>> a date
>> field.  If there is data in the field everything works fine.   
>> However if the
>> field is null, shp2pgsql parses the insert statement as:
>>
>> INSERT INTO "test" (...,"saledate",...) VALUES (...,'',...);
>>
>> pgsql will then throw an error saying:
>>
>> ERROR:  invalid input syntax for type date: ""
>
> DBFIsAttributeNULL() in loader/dbfopen.c recognizes only "00000000"
> as a NULL date; I'm guessing your shapefile has blanks (0x20) instead
> of zeros (0x30).  I wonder if DBFIsAttributeNULL() should perform
> a check for strlen(pszValue) == 0 (leading and trailing blanks will
> have been stripped) as it currently does for data types other than
> Numeric, Float, Date, and Logical.
>
> -- 
> Michael Fuhr
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list