[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
Sun Jun 21 01:46:44 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
Resolution:                 |   Keywords:
----------------------------+-------------------

Comment (by strk):

 Git work is great, but someone will need to double check this because
 the header file also says that function wants the PG name, not the DBF
 name:

   const char *colmap_dbf_by_pg(colmap *map, const char *pgname);
   const char *colmap_pg_by_dbf(colmap *map, const char *dbfname);

 Those signatures are in loader/shpcommon.h, lacking a comment.

 The help output from shp2pgsql says the format is:

          COLUMNNAME DBFFIELD1
          AVERYLONGCOLUMNNAME DBFFIELD2

 So we have the PostgreSQL column name on the left and the
 DBF field name on the right.

 The _same_ format is expected by pgsql2shp
 (yes, key on the right in this case).

 Is the code doing that ?

 You are changing this:

 - const char *mapped = colmap_dbf_by_pg(&state->column_map, dbffieldname);
 + const char *mapped = colmap_dbf_by_pg(&state->column_map, pgfieldname);

 Does not seem to match with parameter names in signature...

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