[Gdal-dev] ogr2ogr generate SQL sintax error

Frank Warmerdam warmerdam at pobox.com
Sun Nov 5 23:26:58 EST 2006


Richard Rossel wrote:
> Hi list, am newbie here and I bring a big problem with me :(
> 
> I try to convert my shapefile into Postgres with ogr2ogr:
> 
> ogr2ogr -select "ID,FRC,FOW" -where "FEATTYP = '4110' AND ROUTENUM !=
> ''" -f "PostgreSQL" PG:"host=localhost user=atlas dbname=atlas"
> cheche________nw.shp
> 
> ERROR 1: INSERT command for new feature failed.
> ERROR:  syntax error at or near "INTO" at character 83
> 
> Command: INSERT INTO "cheche________nw" (WKB_GEOMETRY , "id", "frc",
> "fow") VALUES (INSERT INTO "cheche________nw" (WKB_GEOMETRY , "id",
> "frc", "fow") VALUES
> ('\\001\\002\\000\\000\\000\\003\\000\\000\\0000|3\\0401\\300\\041@\\205\\204\\336\\321\\265\\026G@\\374\\264\\212\\376\\320\\300\\041@\\304D\\336\\315\\256\\026G@\\024\\031\\014d,\\301\\041@\\242\\250}\\204\\253\\026G@', 
> 
> 17561001781772, 4, 3)
> ERROR 1: Terminating translation prematurely after failed
> translation of layer cheche________nw
> 
> I found that the problem is that ogr write "INSERT INTO" twice times.
> I take that sentence, drop the exra "INSERT INTO" and charge into DB
> without problem.
> How can fix it, and populate my DB with shapefile date.

Richard,

This sounds like an ugly bug in the postgis driver, but I'm pretty
surprised.  Could you submit a detailed bug report via bugzilla with
information on the GDAL/OGR version you are using, data files and
the command?

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list