Opened 14 years ago

Closed 14 years ago

#3771 closed defect (fixed)

Using OGR SQL on LIBKML driver returns Sql Parsing error

Reported by: msmitherdc Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords:
Cc: winkey

Description

In trunk

$ogrinfo MarineTraffic.kmz INFO: Open of `MarineTraffic.kmz'

using driver `LIBKML' successful.

1: 0

$ogrinfo MarineTraffic.kmz -sql "select * from 0" INFO: Open of `MarineTraffic.kmz'

using driver `LIBKML' successful.

ERROR 1: SQL Expression Parsing Error: syntax error

$ ogr2ogr -f "ESRI Shapefile" -sql "select name, cast(description as character(500)) description, cast(OGR_STYLE as character(500)) styleurl from 0" marine_locations.shp MarineTraffic.kmz ERROR 1: SQL Expression Parsing Error: syntax error

Change History (3)

comment:1 by Even Rouault, 14 years ago

Workaround : in the SQL expression, surround the 0 with single quotes. 0 isn't a valid identifier in SQL (can be confused with a numeric literal), and you'd get similar errors with PostgreSQL or MySQL that also need quoting for such identifiers.

Perhaps the LIBKML driver should rename the layer to be layer0 instead of just 0 ?

comment:2 by winkey, 14 years ago

fixed in r20720

Driver will now name unknown layers "Layer0" and so on

Brian

comment:3 by winkey, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.