diff --git a/store/postgres/sql_typecasters.go b/store/postgres/sql_typecasters.go index 32bd675ef..a251cebcb 100644 --- a/store/postgres/sql_typecasters.go +++ b/store/postgres/sql_typecasters.go @@ -19,7 +19,7 @@ func fieldToColumnTypeCaster(field rdbms.ModuleFieldTypeDetector, ident string) switch true { case field.IsBoolean(): - tcp := "CASE WHEN %s NOT IN ('', '0', 'false', 'f', 'FALSE', 'F') THEN 1 ELSE 0 END " + tcp := "%s NOT IN ('', '0', 'false', 'f', 'FALSE', 'F')" fc := fmt.Sprintf(fcp, ident) return fmt.Sprintf(tcp, fc), fcp, tcp, nil case field.IsNumeric(): diff --git a/store/tests/compose_records_test.go b/store/tests/compose_records_test.go index 186a12c94..2ceb3590f 100644 --- a/store/tests/compose_records_test.go +++ b/store/tests/compose_records_test.go @@ -350,6 +350,16 @@ func testComposeRecords(t *testing.T, s store.ComposeRecords) { ) req.NoError(err) }) + + t.Run("with bool field", func(t *testing.T) { + var ( + req = require.New(t) + f = types.RecordFilter{Query: `bool1 = true`} + + _, _, err = s.SearchComposeRecords(ctx, mod, f) + ) + req.NoError(err) + }) }) t.Run("paging and sorting", func(t *testing.T) {