Ecto returning Decimal for MyXQL where it returns an integer for Postgres

This appears to be documented behavior of the sum and avg aggregates in MySQL:

The SUM() and AVG() functions return a DECIMAL value for exact-value arguments (integer or DECIMAL), and a DOUBLE value for approximate-value arguments (FLOAT or DOUBLE).

Having survived many data migration projects my best advice is that different database vendors do similar things differently: never take for granted that similar operations are in fact the same operation across database products.