Fix boolean filtering in postgres
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user