Opened 9 years ago

Closed 9 years ago

#5738 closed defect (invalid)

SQLite dialect query fails if a layer name starts with a digit

Reported by: avautour Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: 1.11.0
Severity: normal Keywords:
Cc:

Description

In my case, I had a shape file whose filename started with a digit.

ogrinfo d:\data\vector\10m_cultural\10m_admin_0_countries.shp INFO: Open of `d:\data\vector\10m_cultural\10m_admin_0_countries.shp'

using driver `ESRI Shapefile' successful.

1: 10m_admin_0_countries (Polygon)

ogrinfo -sql "SELECT COUNT(*) from 10m_admin_0_countries" -dialect SQLite d:\data\vector\10m_cultural\10m_admin_0_countries.shp INFO: Open of `d:\data\vector\10m_cultural\10m_admin_0_countries.shp'

using driver `ESRI Shapefile' successful.

ERROR 1: In ExecuteSQL(): sqlite3_prepare(SELECT COUNT(*) from 10m_admin_0_countries):

unrecognized token: "10m_admin_0_countries"

Renaming the file to not have a starting digit fixes the problem.

Change History (1)

comment:1 by Even Rouault, 9 years ago

Resolution: invalid
Status: newclosed

If a layer/table name doesn't start by a letter ,you should surround it by single or double quote characters.

Note: See TracTickets for help on using tickets.