3
0

Include all columns with numeric data type

This commit is contained in:
Mumbi Francis 2023-08-18 14:26:34 +03:00 committed by Jože Fortun
parent cdc8edba3e
commit 95a1efc657

View File

@ -226,9 +226,14 @@ func (d postgresDialect) ExprHandler(n *ql.ASTNode, args ...exp.Expression) (exp
return drivers.OpHandlerNotIn(d, n, args...)
case "like", "nlike":
dalType := n.Args[0].Meta["dal.Attribute"].(*dal.Attribute).Type
if dalType, ok := n.Args[0].Meta["dal.Attribute"].(*dal.Attribute); ok {
col, err := d.AttributeToColumn(dalType)
if err != nil {
return nil, err
}
// if the type is id (numeric) data type, then cast it to text
if dalType != nil && dalType.Type() == dal.AttributeTypeID {
if col.Type.Name == "NUMERIC" {
op := "LIKE"
if ref == "nlike" {
op = "NOT LIKE"
@ -236,6 +241,7 @@ func (d postgresDialect) ExprHandler(n *ql.ASTNode, args ...exp.Expression) (exp
return castColumnDataToText(op, args...)
}
}
}
return ref2exp.RefHandler(n, args...)
}