[postgis-devel] [PostGIS] #748: shp2pgsql use wrong schema name

PostGIS trac at osgeo.org
Fri Mar 18 10:59:49 PDT 2011


#748: shp2pgsql use wrong schema name
-----------------------+----------------------------------------------------
 Reporter:  aperi2007  |       Owner:  pramsey      
     Type:  defect     |      Status:  new          
 Priority:  medium     |   Milestone:  PostGIS 2.0.0
Component:  postgis    |     Version:  trunk        
 Keywords:             |  
-----------------------+----------------------------------------------------

Comment(by jadams):

 I just added a regression test (loader/PointWithSchema) that tries to load
 a shapefile using a schema-qualified name.  Can you verify this test fails
 on windows?

 I am suspicious that this line is wrong:

 shp2pgsql-cli.c 248: snprintf(config->schema, ptr - argv[pgis_optind] + 1,
 "%s", argv[pgis_optind]);

  (note line numbers have changed since earlier comments, this is in the
 section
 /* Determine the table and schema names from the next argument */)

 It's doing some pointer math to decide how many characters to copy, which
 makes me suspicious in the UTF8 / encoding / wide character crazy world we
 live in nowadays.

 I'd suggest trying this instead:

 snprintf(config->schema, strlen(argv[pgis_optind]) - strlen(ptr) + 1,
 "%s", argv[pgis_optind]);

 Unfortunately I don't have a windows build so I can't test it.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/748#comment:20>
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