[postgis-devel] dbf attributes size

strk at refractions.net strk at refractions.net
Mon Oct 24 05:12:04 PDT 2005


I've committed the change implementing the new mapping.

A similar issue exists with FTDouble types in DBF.

When loading these are mapped to float8 if field_width > 18
and to numeric if field_width <= 18.

When dumping, float4,float8 and numeric types are mapped to
FTDouble with field_width of 32, so loading back the dumped
shape will force them to 'numeric'...

Is attempting at a stricter mapping a dangerous task ?

--strk;

On Mon, Oct 24, 2005 at 12:57:14PM +0200, strk at refractions.net wrote:
> Hello there, I'm taking a look at shp2pgsql and pgsql2shp
> trying to make numerical attribute size handling stricter.
> 
> Currently, the loader uses this conservative/pessimistic mapping:
> 
> 	DBF_SIZE	SQL_TYPE
> 	0-9		int4		
> 	10-18		int8		
> 	19-x		numeric(size,0)
> 
> And the dumper uses a size of 16 of dbf attributes of any sql integer type:
> 
> 	SQL_TYPE	DBF_SIZE
> 	int2		16
> 	int4		16
> 	int8		16
> 
> For what I can tell the correct mapping between integer DBF attributes
> and sql types should be as follows:
> 
> 	DBF_SIZE	SQL_TYPE	LONGEST_TEXT_REP
> 	0-6		int2		-32768
> 	7-11		int4		-2147483648
> 	12-20		int8		-9223372036854775808
> 	21-x		numeric(size,0)
> 
> Does anyone see any drawback in implementing this mapping ?
> 
> 
> --strk;
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list