As soon as an aggregate function is used, SQLite seems to loose the type affinity of the expression, e.g.:
CREATE TABLE fun ( value INT );
CREATE VIEW fun_sum AS SELECT SUM(value) AS combined FROM fun;
Results in:
/// Column `combined ` (`ANY`), optional (default: `nil`).
public var combined : String?
Which isn't great.
Adding CASTs doesn't seem to help with that, the affinity is lost by the aggregate function.
To fix that, we'd probably have to parse the SQL and follow the type-affinity in the expression AST. Possible but work.
As soon as an aggregate function is used, SQLite seems to loose the type affinity of the expression, e.g.:
Results in:
Which isn't great.
Adding
CAST
s doesn't seem to help with that, the affinity is lost by the aggregate function. To fix that, we'd probably have to parse the SQL and follow the type-affinity in the expression AST. Possible but work.