[postgis-devel] [PostGIS] #885: pgsql2shp fields conversion from predefined list

PostGIS trac at osgeo.org
Sun Apr 3 02:31:24 PDT 2011

#885: pgsql2shp fields conversion from predefined list
  Reporter:  rodo         |       Owner:  loic         
      Type:  enhancement  |      Status:  reopened     
  Priority:  medium       |   Milestone:  PostGIS 2.0.0
 Component:  postgis      |     Version:  trunk        
Resolution:               |    Keywords:               

Comment(by loic):

 By "ensure unique name" spot of the code I assume you are refering to
 loader/pgsql2shp-core.c lines
                  * make sure the fields all have unique names,
                 tmpint = 1;
                 for (j = 0; j < state->fieldcount; j++)
                         if (!strncasecmp(dbffieldname,
 state->dbffieldnames[j], 10))
                                 sprintf(dbffieldname, "%.7s_%.2d", ptr,

 which are left untouched by the patch and occur after the mapping function
 is called:
 -               dbffieldname = malloc(11);
 -               strncpy(dbffieldname, ptr, 10);
 -               dbffieldname[10] = '\0';
 +               dbffieldname = ShpDumperFieldnameLimit(ptr, state);
 My reasoning for keeping this part is that if, presumably by mistake, the
 provided symbol map contains duplicates, enforcing uniqueness will help
 ensure the consistency of the generated file. If the map does not produce
 duplicate symbols, the {{{make sure the fields all have unique names}}}
 lines will do nothing.
 Am I making sense ?

Ticket URL: <http://trac.osgeo.org/postgis/ticket/885#comment:8>
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-devel mailing list