Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6963 closed defect (invalid)

OGR SQL limits table name character set

Reported by: theroggy Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description (last modified by theroggy)

When executing an sql statement on a shapefile that has '-' in the filename you get an error. It seems the sql parser doesn't support this.

Can be reproduced like this:

ogrinfo Perc_2017-06-11_ANTW.shp -sql "select * from Perc_2017-06-11_ANTW"
INFO: Open of `Perc_2017-06-11_ANTW.shp' using driver `ESRI Shapefile' successful.
ERROR 1: SQL Expression Parsing Error: syntax error, unexpected '-', expecting end of string. 
Occurred around : select * from Perc_2017-06-11_ANTW
                                         ^

Change History (3)

comment:1 by theroggy, 7 years ago

Description: modified (diff)

comment:2 by Even Rouault, 7 years ago

Resolution: invalid
Status: newclosed

You need to double quote columns or tables identifiers that have special characters like '-' (and as you use shell commands escape them with \

ogrinfo Perc_2017-06-11_ANTW.shp -sql "select * from \"Perc_2017-06-11_ANTW\""

This is conformant with the SQL92 standard

comment:3 by theroggy, 7 years ago

Ok, thanks!

Note: See TracTickets for help on using tickets.