[postgis-devel] Shp2pgsql picks wrong field type?

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Wed Apr 6 01:25:13 PDT 2005


Hi guys,

Here's another problem I've found with the shapefile loader for PostGIS
1.0.0-rc6 where it picks up the wrong datatype for a column.

The problem can be seen in this TIGER shapefile which I've copied to
http://www.webbased.co.uk/mca/tmp/lkA12133.zip. Extract the ZIP, and then
run shp2pgsql on the shapefile to produce the .sql file, and then try and
load the .sql into the database. What happens is that some of the
transactions fail during the load.

Taking a closer look, it appears as if shp2pgsql determines the wrong
datatype for the "fraddr" field, which shp2pgsql assumes is an int8. This is
fine until the .sql script gets to line 1153 at which point we find the
"fraddr" field is set to '11-82' which of course will cause the insert to
fail.

I'm not sure yet whether this is an incorrectly generated shapefile or a
bug, however what should shp2pgsql do (if anything) if it detects data that
doesn't correctly match the field type?


Many thanks,

Mark.

------------------------
WebBased Ltd
South West Technology Centre
Tamar Science Park
Plymouth
PL6 8BT 

T: +44 (0)1752 791021
F: +44 (0)1752 791023
W: http://www.webbased.co.uk





More information about the postgis-devel mailing list