[gdal-dev] RFC28 OGR SQL Expressions now in trunk

Even Rouault even.rouault at mines-paris.org
Thu Sep 16 13:13:45 EDT 2010


For the record, if I create a postgres table 0, I need to double-quote it when 
issuing a SQL query, like :

ogrinfo pg:dbname=autotest -sql 'select * from "0"'

and mysql needs also quoting, but they use reverse slash  `  character instead 
of double-quote.

So the new syntax isn't something that strange. I have no strong opinion if we 
should relax the restriction to the previous behaviour or not.

Le mercredi 15 septembre 2010 03:00:15, Frank Warmerdam a écrit :
> Smith, Michael ERDC-CRREL-NH wrote:
> > Frank,
> > 
> > I was testing accesing the OGR_STYLE value from a kmz file using the
> > LIBKML driver. Previously this had worked.
> > 
> > u4rt9mds at maps:/htdocs/dhs/marine$ ogr2ogr -f OCI
> > oci:"user/pass at tns:marinetest MarineTraffic.kmz -nln MArineTest3 -lco
> > dim=2 -lco srid-8265 -lco launder=yes -lco precision=no -sql "select *,
> > ogr_style from 0"
> > OGR: OGROpen(MarineTraffic.kmz/0x13bb63a0) succeeded as LIBKML.
> > ERROR 1: SQL Expression Parsing Error: syntax error
> 
> Mike,
> 
> The problem seems to be the table named 0 rather than the ogr_style
> portion.  Currently well formed identifiers must start with a letter or
> an underscore, not a numeric digit.  You can however quote it.
> 
> So 'select *, ogr_style from "0"' should work.
> 
> This is definitely a backward compatability issue, but it isn't clear to me
> whether I ought to try and change it or not.  Thoughts welcome.
> 
> Best regards,


More information about the gdal-dev mailing list