Bug report #21805

Filter on GeoPackage against column with data type Boolean does not work

Added by Brett Carlock over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:3.6.1 Regression?:No
Operating System:Win10 x64 Pro (1809 Build 17763.404) Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29620

Description

STR:
Have a layer with features representing a boolean-representable state, here: AFFECTED (impact assessment).

Assign boolean 1/TRUE to a number of features within the layer that are affected in your impact analysis.

Attempt to filter on the layer by using a filter of:
"AFFECTED" IS 'true'
0 features

"AFFECTED" = 'true'
0 features

"AFFECTED" == 'true'
0 features

All other values in AFFECTED column were <NULL>. The only way I can get the expression to filter as expected is to simply put a filter of :
"AFFECTED"

Annotation 2019-04-10 151141.png - QGIS 2.18.28 under WSL Debian. (50.2 KB) Brett Carlock, 2019-04-10 09:12 PM

Annotation 2019-04-10 151221.png - QGIS 3.6.1 under Win10 x64 1903. (26.9 KB) Brett Carlock, 2019-04-10 09:12 PM

Associated revisions

Revision 4ee40991
Added by Jürgen Fischer over 5 years ago

query builder: fix #21805 & #21966 & #21967

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Feedback

I can't confirm here.
I tested using a postGIS vector, with a column of type varchar called "affected" and some features filled with the text 'TRUE'. The expression/filter

"affected" = 'TRUE'

works as expected.

#2 Updated by Brett Carlock over 5 years ago

Giovanni Manghi wrote:

I can't confirm here.
I tested using a postGIS vector, with a column of type varchar called "affected" and some features filled with the text 'TRUE'. The expression/filter

"affected" = 'TRUE'

works as expected.

Giovanni, I'm seeing that I missed a critical detail in my initial report.

I'm using specifically the Boolean data type for the column AFFECTED within my geopackage (not varchar like yours). Can you test similarly with your PostGIS layer if it supports the same data type for a column?

I can upload an example if needed upon request.

#3 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Feedback to Open
  • Subject changed from Filter on GeoPackage against column with object type Boolean broken to Filter on GeoPackage against column with data type Boolean does not work

Brett Carlock wrote:

Giovanni Manghi wrote:

I can't confirm here.
I tested using a postGIS vector, with a column of type varchar called "affected" and some features filled with the text 'TRUE'. The expression/filter

"affected" = 'TRUE'

works as expected.

Giovanni, I'm seeing that I missed a critical detail in my initial report.

I'm using specifically the Boolean data type for the column AFFECTED within my geopackage (not varchar like yours). Can you test similarly with your PostGIS layer if it supports the same data type for a column?

I can upload an example if needed upon request.

just tried with the postgresql datatype boolean, still works.
But I can confirm that with gpkg bool type, things do not work as expected.

It would be nice if you can test if this is a regression, i.e. if it works on 2.18

#4 Updated by Brett Carlock over 5 years ago

Giovanni Manghi wrote:

just tried with the postgresql datatype boolean, still works.
But I can confirm that with gpkg bool type, things do not work as expected.

It would be nice if you can test if this is a regression, i.e. if it works on 2.18

Tested against QGIS 2.18.28 under WSL Debian Buster. Works as expected when picking the values from the Query Builder GUI.
However, the Query Builder/Filter GUI exposes the boolean values as 1 or 0, not true and false as does the QGIS 3.6.1 Query Builder GUI.

So, that got me to thinking & testing with QGIS 3.6.1:
Values picked from the Query Builder: 'true' or 'false'. These are single-quoted strings. These do NOT work.
Values typed manually: 1 or 0. These are integers/boolean. These DO work.
Values typed manually: true or false. These are not single-quoted. These DO work.

#5 Updated by Jürgen Fischer over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF