From: Sandro Santilli Date: Mon, 24 Oct 2005 16:12:41 +0000 (+0000) Subject: Reverted backport of stricter INTEGER and STRING attributes handling. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1afeceac458d3e544e88bd187cab34c5d74d140a;p=postgis Reverted backport of stricter INTEGER and STRING attributes handling. The change is too big to appear in the 1.0 branch. git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1994 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/pgsql2shp.c b/loader/pgsql2shp.c index 2bfe256e5..5dd322105 100644 --- a/loader/pgsql2shp.c +++ b/loader/pgsql2shp.c @@ -2414,8 +2414,7 @@ initialize(void) if ( schema ) { - sprintf(query, "SELECT a.attname, a.atttypid, a.attlen, " - "a.atttypmod FROM " + sprintf(query, "SELECT a.attname, a.atttypid, a.attlen FROM " "pg_attribute a, pg_class c, pg_namespace n WHERE " "n.nspname = '%s' AND a.attrelid = c.oid AND " "n.oid = c.relnamespace AND " @@ -2424,8 +2423,7 @@ initialize(void) } else { - sprintf(query, "SELECT a.attname, a.atttypid, a.attlen, " - "a.atttypmod FROM " + sprintf(query, "SELECT a.attname, a.atttypid, a.attlen FROM " "pg_attribute a, pg_class c WHERE " "a.attrelid = c.oid and a.attnum > 0 AND " "a.atttypid != 0 AND " @@ -2473,7 +2471,7 @@ initialize(void) for (i=0; ipachFieldType[j] == 'D' ) /* Date field */ { @@ -527,31 +527,22 @@ CreateTable(void) if(type == FTString) { - // use DBF attribute size as maximum width - printf ("varchar(%d)", field_width); + printf ("varchar"); } else if(type == FTInteger) { - if ( forceint4 ) + if ( forceint4 || field_width <= 9 ) { printf ("int4"); } - else if ( field_width <= 5 ) + else if( field_width > 18 ) { - printf ("int2"); - } - else if ( field_width <= 10 ) - { - printf ("int4"); - } - else if ( field_width <= 19 ) - { - printf ("int8"); + printf("numeric(%d,0)", + field_width); } else { - printf("numeric(%d,0)", - field_width); + printf ("int8"); } } else if(type == FTDouble) @@ -1670,6 +1661,10 @@ utf8 (const char *fromcode, char *inputbuf) /********************************************************************** * $Log$ + * Revision 1.88.2.13 2005/10/24 16:12:41 strk + * Reverted backport of stricter INTEGER and STRING attributes handling. + * The change is too big to appear in the 1.0 branch. + * * Revision 1.88.2.12 2005/10/24 15:54:16 strk * fixed wrong assumption about maximum size of integer attributes (width is maximum size of text representation) *