I have layer in qgis. It has an attribute data_count (Integer)
and a value (String)
.
When I filer for "value" ~ 'maximum-speed-limit'
it works. When I filter for "data_count" > 10
it works as well.
But when I use "data_count" > 5 AND "value" ~ 'maximum-speed-limit'
it says error:
An error occurred when executing the query.
The data provider said:
OGR[3] error 1: SQL Expression Parsing Error: syntax error, unexpected $undefined, expecting end of string. Occurred around :
"data_count" > 5 AND "value" ~ 'maximum-speed-limit'
But if I don't use regexp, but use LIKE
instead, it works perfectly : "data_count" > 5 AND "value" LIKE '%maximum-speed-limit%'
Why is that happening? I tried and see that other "more complicated" regexp expressions don't work either, like "value" ~'[0-9].*
. But then why the simple "somevalue"~'sometext'
works? I have read the QGIS documentation but the answer is not clear to me.
~
is not supported in Layer Filter for OGR layers, (defaults to SQLite which does not support~
unlike Postgres). Can you confirm that when you say"value" ~ 'maximum-speed-limit'
works, it actually filters the results correctly, rather than just not throwing up an error message? Because with gpkg and a simple~
expression, if I press Test it shows an error, but if I press OK it silently lets me through - however there are no filtered results.