3
0

Fix boolean filtering in postgres

This commit is contained in:
Denis Arh
2021-03-11 16:53:27 +01:00
parent 10d4d5e26a
commit 261dd4f74e
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -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():
+10
View File
@@ -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) {