pub fn sum<'a, V, E>(
expr: E,
) -> SQLExpr<'a, V, <E::SQLType as AggregatePolicy<V::DialectMarker>>::Sum, Null, Agg>Expand description
SUM(expr) - sums numeric values.
Requires the expression to be Numeric (Int, BigInt, Float, Double).
Result type is dialect-aware.
Returns a nullable expression (empty set returns NULL).
§Type Safety
// ✅ OK: Numeric column
sum(orders.amount);
// SQLite: same width for integer sums
// PostgreSQL: Int/SmallInt promote to BigInt
// ❌ Compile error: Text is not Numeric
sum(users.name);