[postgis-users] Maintain length and precision for numneric fields in pgsql2shp and shp2pgsql

Paul Ramsey pramsey at refractions.net
Wed Jan 23 08:59:38 PST 2008


On Jan 23, 2008, at 3:39 AM, Peter Hopfgartner wrote:

> we were looking at the tables generated by shp2pgsql. As it seems,  
> numeric(m, 0) is mapped, if possible to integers, and numeric(m,n)  
> is mapped to numeric.

Do you mean, mapped to float?

> We would like to optionally maintain the numeric length and  
> precision for our data imports. Looking at shp2pgsql.c,  this should  
> be rather simple. Basically, we could add an option, let's say '-K'  
> for keep precision, and modify the code around line 550.

This is possible. You need to be aware of the *massive* performance  
penalty that comes with using numeric instead of integer/float.  As  
long as you are clear on that, it's certainly acceptable.

Since we have -i for "force to integer" how about -n for "use numeric  
for all numbers"?

> A similar change could be done for pgsql2shp, modifying the SQL  
> query, which gets the type information from PostgreSQL and changing  
> the code generating the dbf header.
>
> If such a change is welcomed, we can try to have it done soon.
>
> Regards,
>
> Peter Hopfgartner and Sergio Segala
>
> R3 GIS
> http://www.r3-gis.com
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list