[postgis-commits] svn - r2717 - trunk/loader

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Fri Nov 23 02:42:10 PST 2007


Author: mcayland
Date: 2007-11-23 02:42:09 -0800 (Fri, 23 Nov 2007)
New Revision: 2717

Modified:
   trunk/loader/shp2pgsql.c
Log:
Apply Tom Glancy's patch to shp2pgsql which corrects an off-by-one error in the field_width calculation when determining which SQL numeric type is required depending upon the length of the corresponding shapefile field. This should eliminate various out of range error messages that may have appeared when attempting to load a converted shapefile into PostgreSQL.

Modified: trunk/loader/shp2pgsql.c
===================================================================
--- trunk/loader/shp2pgsql.c	2007-11-23 10:24:00 UTC (rev 2716)
+++ trunk/loader/shp2pgsql.c	2007-11-23 10:42:09 UTC (rev 2717)
@@ -536,15 +536,15 @@
 			{
 				printf ("int4");
 			}
-			else if  ( field_width <= 5 )
+			else if  ( field_width < 5 )
 			{
 				printf ("int2");
 			}
-			else if  ( field_width <= 10 )
+			else if  ( field_width < 10 )
 			{
 				printf ("int4");
 			}
-			else if  ( field_width <= 19 )
+			else if  ( field_width < 19 )
 			{
 				printf ("int8");
 			}



More information about the postgis-commits mailing list