[postgis-users] Overflow on length field during insert

Frank Warmerdam warmerdam at pobox.com
Mon Feb 9 14:26:06 PST 2004


Tyler Mitchell wrote:
> 
> I'm inserting some shapes using ogr2ogr and getting an interesting 
> error.  Here's my syntax and error message:
> 
> --------
> $ ogr2ogr -f "PostgreSQL" PG:dbname=geos_test ttrn_roads.shp -lco 
> LAUNDER=YES -nln trim_trn_roads ttrn_roads OVERWRITE=YES
> 
> ERROR 1: INSERT command for new feature failed.
> ERROR:  overflow on numeric ABS(value) >= 10^2 for field with precision 
> 13 scale 11
> 
> ERROR 1: Terminating translation prematurely after failed
> translation of layer ttrn_roads
> ---------
> 
>  From looking at the structure of the fields in this file I assume the 
> problem is with my "length" field.  This is a hangover from the original 
> ArcInfo coverage source.  Is data type of Real(13.11) valid?
> 
> 
> Here's the details from ogrinfo:
> 
> ----------
> 
> $ ogrinfo -summary ttrn_roads.shp ttrn_roads
> INFO: Open of `ttrn_roads.shp'
> using driver `ESRI Shapefile' successful.
> 
> Layer name: ttrn_roads
> Geometry: Line String
> Feature Count: 78476
> Extent: (418178.000000, 5650301.000000) - (623456.000000, 5862439.000000)
> Layer SRS WKT:
> <snip>
> LENGTH: Real (13.11)
> <snip>
> 

Tyler,

This is a "bug" in OGR, so you may report it in the OGR bugzilla if you wish.
However, there is an easy workaround.  Use the PRECISION layer creation option
and set it to NO.  This will prevent OGR from trying to preserve the origin
dataset precision in Postgres.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the postgis-users mailing list