An Ecto decimal type retaining DuckDB cast precision and scale.
alias QuackDB.Ecto.Decimal, as: DuckDecimal
decimal = Ecto.ParameterizedType.init(DuckDecimal, precision: 18, scale: 4)
estimate = dynamic([t], type(t.fields[^field], ^decimal))
predicate = dynamic([t], ^estimate > ^minimum)
from t in "tasks", where: ^predicateImport Ecto.Query or use QuackDB.Ecto for these query macros. Unlike bare
:decimal (DuckDB DECIMAL(18,3)), this type emits the specified precision
and scale in SQL casts. Values use ordinary Ecto decimal casting/loading;
DuckDB enforces the SQL precision and scale, including rounding and overflow.