Bug report #2007
Query builders LIKE statement treats every string like '%string%' with DBF backend
|Affected QGIS version:||Regression?:||No|
|Operating System:||Gentoo||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||12067|
- Open Shapefile;
- Open attribute table;
- Open query builder;
- Create following query:
mycolumn LIKE 'A%'
- Test result.
Result set should contain only mycolumn entries that start with "A" letter, still they will contain also any entry that has "A" letter in it. Seems like "%" and "_" are ignored and string is allways treated like "%%" one.
I have no idea if it's only DBF related (limitation?) or not, but as queries in query builder return wrong data sets, something must be done to warn user about QGIS specific SQL dialect, if it's not possible to fix this issue.
#3 Updated by marisn - about 11 years ago
Good news - it's NOT an GDAL/OGR bug but a QGIS bug :) Tested with 1.6.2 ogrinfo -where and -sql options - OGR returns correct results. QGIS 1.2.0 and current trunk - NOT correct results. I will attach sample dataset.Steps to reproduce:
- Open file (UTF-8 coding);
- Open Attribute table;
- Advanced search;
- At SQL where clause enter following text:
NOSAUKUMS LIKE 'S%'
- Press OK.
I get 4 results - also "CESIS", still "CESIS" doesn't match 'S%' pattern.