[postgis-users] Problem with date fields in shp2pgsql

Bruce Rindahl rindahl at lrcwe.com
Sat Sep 9 11:22:42 PDT 2006


Is this change in the latest SVN?
Thanks
 Bruce

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Saturday, September 09, 2006 10:42 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Problem with date fields in shp2pgsql

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

_______________________________________________
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