Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4261 closed defect (fixed)

OGR SQL: another `where' versus `-where' issue

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: OGR_SQL
Cc:

Description

When making an inappropriate -where query related to the string type attribute CellCode, ogrinfo gives an error (as expected), but nevertheless returns all features in the dataset, see (1).

When making the same inappropriate query by using -sql "...", I only get the error message, no features are returned, as I would expect, see (2)

(0)

$ cat grid.gmt
# @VGMT1.0 @GPOLYGON
# @R0/20/0/10
# @Je3035
# @NCellCode|EofOrigin|NofOrigin
# @Tstring|integer|integer
# FEATURE_DATA
>
# @D10mE0N0|0|0
# @P
0 0
0 10
10 10
10 0
0 0
>
# @D10mE1N0|10|0
# @P
10 0
10 10
20 10
20 0
10 0

(1)

$ ogrinfo -al -q -geom=no grid.gmt -where CellCode=10mE0N0
ERROR 1: SQL Expression Parsing Error: syntax error

Layer name: grid
OGRFeature(grid):0
  CellCode (String) = 10mE0N0
  EofOrigin (Integer) = 0
  NofOrigin (Integer) = 0

OGRFeature(grid):1
  CellCode (String) = 10mE1N0
  EofOrigin (Integer) = 10
  NofOrigin (Integer) = 0

(2)

$ ogrinfo -q -geom=no grid.gmt -sql "select * from grid where CellCode=10mE0N0"
ERROR 1: SQL Expression Parsing Error: syntax error
$

Change History (2)

comment:1 by Even Rouault, 13 years ago

Component: defaultOGR_SF
Milestone: 1.9.0
Resolution: fixed
Status: newclosed

r23119 /trunk/gdal/apps/ (ogr2ogr.cpp ogrinfo.cpp): ogrinfo/ogr2ogr: exit when SetAttributeFilter() fails, instead of silently going on (#4261)

comment:2 by Even Rouault, 13 years ago

r23139 /trunk/gdal/swig/ (4 files in 2 dirs): Resync ogrinfo.py/.java and ogr2ogr.py/.java (#4261)

Note: See TracTickets for help on using tickets.