[postgis-tickets] [PostGIS] #4705: pgsql2shp - Pg field column in mapping file incorrectly compared with the name of the dbf field name

PostGIS trac at osgeo.org
Tue Jun 16 04:12:45 PDT 2020


#4705: pgsql2shp - Pg field column in mapping file incorrectly compared with the
name of the dbf field name
---------------------------+-------------------
 Reporter:  zezzagio       |      Owner:  robe
     Type:  defect         |     Status:  new
 Priority:  medium         |  Milestone:
Component:  loader/dumper  |    Version:  3.0.x
 Keywords:                 |
---------------------------+-------------------
 The first column in the mapping file (postgres field name) is incorrectly
 compared with the name of dbf field (wich defaults to the first 10
 characters of the postgres name).

 This makes it impossible to recognize (and therefore rename) a postgres
 field longer than 10 characters.

 This affect surely version 3.0.x, but I suspect some other previous
 versions too.

 Refer even to:
 https://stackoverflow.com/questions/61365672

 Proposed patch:

 https://github.com/zezzagio/postgis

 {{{
 diff --git a/loader/pgsql2shp-core.c b/loader/pgsql2shp-core.c
 index 1596dc206..06226e951 100644
 --- a/loader/pgsql2shp-core.c
 +++ b/loader/pgsql2shp-core.c
 @@ -1536,7 +1536,7 @@ ShpDumperOpenTable(SHPDUMPERSTATE *state)
                  * use this to create the dbf field name from
                  * the PostgreSQL column name */
                 {
 -                       const char *mapped =
 colmap_dbf_by_pg(&state->column_map, dbffieldname);
 +                       const char *mapped =
 colmap_dbf_by_pg(&state->column_map, pgfieldname);
                         if (mapped)
                         {
                                 strncpy(dbffieldname, mapped, 10);

 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4705>
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