[gdal-dev] [ OGR SQL: Excecuting select where column name starts with "_" SO: Windows 7, GDAL/OGR 1.9.x

Etienne Tourigny etourigny.dev at gmail.com
Thu Oct 11 14:06:05 PDT 2012


try enclosing the column with single or double quotes?

On Tue, Oct 9, 2012 at 5:35 PM, Gabriel Fusca
<gabrielfusca at suremptec.com.ar> wrote:
>
> Hi,
>
> I´m getting a sql parsing error when I tried to execute a query to a
> shapefile where column name starts with "_".
>
> When i execute a query like : ogrinfo Provincias.shp -sql "SELECT * FROM
> Provincias WHERE tipo = 1"
>
> INFO: Open of `Provincias.shp'
>       using driver `ESRI Shapefile' successful.
> Layer name: Provincias
> Geometry: Line String
> Feature Count: 21
> Extent: (309062.030000, 3895521.900000) - (2039227.590000, 7591083.240000)
> Layer SRS WKT:
> PROJCS["500K",
>     GEOGCS["GCS_WGS_1984",
>         DATUM["WGS_1984",
>             SPHEROID["WGS_84",6378137.0,298.257223563]],
>         PRIMEM["Greenwich",0.0],
>         UNIT["Degree",0.017453292519943295]],
>     PROJECTION["Transverse_Mercator"],
>     PARAMETER["False_Easting",1000000.0],
>     PARAMETER["False_Northing",0.0],
>     PARAMETER["Central_Meridian",-64.0],
>     PARAMETER["Scale_Factor",1.0],
>     PARAMETER["Latitude_Of_Origin",-90.0],
>     UNIT["Meter",1.0]]
> ID: String (1.0)
> _tipo_Area: Integer (10.0)
> _desc_Area: String (1.0)
> tipo: Integer (10.0)
> OGRFeature(Provincias):29
>   ID (String) = 0
>   _tipo_Area (Integer) = 1
>   _desc_Area (String) = (null)
>   tipo (Integer) = 1
>   LINESTRING (873405.76 7463549.34,873313.54 7463695.39,872765.09
> 7465104.71,872
> 623.98 7465495.26)
>
> But when i want to execute a query like "SELECT * FROM Provincias WHERE
> _tipoArea = 1"
>
>
>> ogrinfo Provincias.shp -sql "SELECT * FROM
> WHERE _tipo_Area = 1"
> INFO: Open of `Provincias.shp'
>       using driver `ESRI Shapefile' successful.
> ERROR 1: SQL Expression Parsing Error: syntax error
>
>
> Any ideas on how to get around this?
>
> Best regards,
>
> --
> Gabriel Fusca
> SUR Emprendimientos Tecnológicos
>
> Perú 345  Piso 5to Oficina "B" (C1067AAG)
> Ciudad de Buenos Aires, Argentina
> Tel. +54 (11) 4342-2976/84
> gabrielfusca at suremptec.com.ar
> http://www.suremptec.com/
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list