Ticket #3771 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Changed 3 years ago by rouault

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 ?

Changed 3 years ago by winkey

fixed in r20720

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

Brian

Changed 3 years ago by winkey

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.