Description
Numeric aggregate functions accept character string values due to implicit casts added by type coercion:
SELECT AVG('100') > Gets transformed into SELECT AVG("100"::DECIMAL(MAX_PREC, MAX_SCALE))
Explanation
This particular cast is added since AVG function uses FamilyOperandTypeChecker that always coerces its arguments if possible (it calls TypeCoercion::builtinFunctionCoercion, which in turn calls TypeCoercion::implicitCast(t1, t2) .
Expected behaviour
Aggregate functions that accept only numeric types should be rejected by the validator, when called with arguments of other types.
Attachments
Issue Links
- is fixed by
-
IGNITE-23042 Sql. Forbid implicit casts between different type families
- Resolved