[gdal-dev] How to escape "desc" with OGR SQL?

Jukka Rahkonen jukka.rahkonen at maanmittauslaitos.fi
Thu Jun 16 10:18:16 PDT 2016


Hi,

I had a need to convert  some data into GPX format and populate the GPX
attributes "name" and "desc". Name was not any problem as can be tested with
ogrinfo -sql "select attr_1 as name from test" test.shp

However, "desc" is a SQL keyword for descending order and all my trials with
OGR SQL failed like this:
ogrinfo -sql "select attr_2 as "desc" from test" test.shp 
ERROR 1: SQL Expression Parsing Error: syntax error, unexpected DESC,
expecting identifier. Occurred around :
select attr_2 as desc from test
                 ^
I managed to do the job with SQLite dialect but I wonder if I found a bug
with using "desc" as an identifier.

-Jukka Rahkonen-



More information about the gdal-dev mailing list