[postgis-tickets] [PostGIS] #2850: Preserve scale and precision when generating shape file with pgsql2shp

PostGIS trac at osgeo.org
Fri Jul 25 06:33:46 PDT 2014


#2850: Preserve scale and precision when generating shape file with pgsql2shp
---------------------------+------------------------------------------------
 Reporter:  hopfgartner    |       Owner:  mcayland     
     Type:  enhancement    |      Status:  new          
 Priority:  medium         |   Milestone:  PostGIS 2.2.0
Component:  loader/dumper  |     Version:  2.1.x        
 Keywords:  pgsql2shp      |  
---------------------------+------------------------------------------------

Comment(by strk):

 With your patch applied, I tried the following:
 {{{
 ./pgsql2shp strk "select 1.2345678901234::numeric(12,12)"
 }}}

 The numeric(12,12) form tells PostgreSQL that there are a total of 12
 significant digits, and all of them are in the decimal part. Ref:
 http://www.postgresql.org/docs/9.1/static/datatype-numeric.html

 In output (with your patch), I get (checked with dbfview -e):
 {{{
 Field Name      Type    Length  Decimal Pos
 Numeric           N        12      12
 Numeric    : 0.1234567890
 }}}

 You can see the actual value is truncated to 12 _characters_ rather than
 significant digits.
 Without your patch, I get:
 {{{
 Field Name      Type    Length  Decimal Pos
 Numeric           N        32      10
 Numeric    : 0.123456789012
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2850#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list