Even Rouault <even.rouault <at> spatialys.com> writes: > On Windows shell I suppose ? Perhaps with \" (not tried) > > ogrinfo -sql "select attr_2 as \"desc\" from test" test.shp
This really works for me on Windows. > On Linux bash the following - using single quote for the full SQL - also works > (not sure on Windows) For sure does not work on Windows. > 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. > > Probably SQLite is more tolerant about using reserved keywords in non- > ambiguous situations. Ahh, I understand now. If I write just "desc" the double quotes are actually removed but SQLite does not care in this case. But I can't do select... as "union" because now SQLite complains ERROR 1: In ExecuteSQL(): sqlite3_prepare(select attr_2 as union from test): near "union": syntax error I must write it escaped select... as \"union\" instead so that double quotes are protected. Are there other characters than " which may need escaping? I guess % and _ but probably there are more. -Jukka Rahkonen- _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
