[Gdal-dev] date fields truncated using ogr2ogr to load shpfile into psql

Howard Butler hobu at iastate.edu
Sun Dec 10 20:17:44 EST 2006


On Dec 10, 2006, at 7:09 PM, Howard Butler wrote:

>
> On Dec 10, 2006, at 6:28 PM, John.C.Cartwright at noaa.gov wrote:
>
>> Hello All,
>>
>> I'm trying to use ogr2ogr to load a shapefile into a postgis  
>> database,
>> and having trouble w/ the date filelds.  The shapefile describes  
>> OK, but
>> the SQL generated by ogr2ogr seems to be truncating the date field.
>>
>> lynx:/usr/local/shapefiles jcc$ ogr2ogr -f postgresql -a_srs EPSG: 
>> 4326
>> PG:dbname=jcc -overwrite osmc.shp
>> ERROR 1: INSERT command for new feature failed.
>> ERROR:  invalid input syntax for type date: "2006/12/"
>>
>> Command: INSERT INTO "osmc" (wkb_geometry , "platform_i",  
>> "max_observ",
>> "observatio", "platform_t", "num_observ", "objectid") VALUES
>> (GeomFromEWKT('SRID=4326;POINT (-29.30999999999991
>> -41.889999999999972)'::TEXT) , '33627', '2006/12/', '2006/12/',
>> 'DRIFTING BUOY', 133, 7469241)
>> ERROR 1: Terminating translation prematurely after failed
>> translation of layer osmc
>>
>>
>
> John,
>
> It appears for the feature it is bombing on that the dates it is  
> trying to insert are bogus
>
> '2006/12'
>
> I would guess this date also needs a day (or month if they're the  
> other way around) for OGR to properly parse it into a date to  
> insert into PG.  I can't speak to whether or not it is supposed to  
> be able to insert dates in this form, however.
>
> Howard
>

Sorry, I misread the post.  This is very likely a bug.  Which version  
of GDAL are you using?  I recall there being some date work in the PG  
driver after the 1.3.2 release.  If you are using a recent version,  
can you file a bug and zip up a shapefile with a couple of offending  
features?

Howard





More information about the Gdal-dev mailing list