From: Paul Ramsey Date: Thu, 23 Apr 2015 19:36:10 +0000 (+0000) Subject: #3048, shp2pgsql - illegal number format when specific system locale set X-Git-Tag: 2.2.0rc1~552 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f96b4d20e91eb7f8a0059397efb6e5b93870c6a;p=postgis #3048, shp2pgsql - illegal number format when specific system locale set git-svn-id: http://svn.osgeo.org/postgis/trunk@13439 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index 457eca201..68f1bdaf8 100644 --- a/NEWS +++ b/NEWS @@ -92,11 +92,12 @@ PostGIS 2.2.0 like geometry extent - #2822, Use @ operator instead of ST_CoveredBy() for raster max extent constraint + - #3018, GROUP BY geography sometimes returns duplicate rows - #3020, ST_AddBand out-db bug where height using width value + - #3048, shp2pgsql - illegal number format when specific system locale set - #3061, Allow duplicate points in JSON, GML, GML ST_GeomFrom* functions - #3086, ST_DumpValues() crashes backend on cleanup with invalid band indexes - - #3018, GROUP BY geography sometimes returns duplicate rows * Code refactoring * diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c index b16c3dfc6..47f5202c9 100644 --- a/loader/shp2pgsql-core.c +++ b/loader/shp2pgsql-core.c @@ -1793,6 +1793,9 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco /* Add the shape attribute if we are reading it */ if (state->config->readshape == 1) { + /* Force the locale to C */ + char *oldlocale = setlocale(LC_NUMERIC, "C"); + /* Handle the case of a NULL shape */ if (obj->nVertices == 0) { @@ -1885,6 +1888,8 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco /* Tidy up everything */ SHPDestroyObject(obj); + + setlocale(LC_NUMERIC, oldlocale); } /* Close the line correctly for dump/insert format */