jamdb_oracle icon indicating copy to clipboard operation
jamdb_oracle copied to clipboard

Ecto V3.12.0 (2024-08-12) breaking change for queries

Open twister3454 opened this issue 5 months ago • 3 comments

jamedb_oracle Master branch v 0.5.10

From the changelog for Ecto V3.12.0 (2024-08-12): "distinct, group_by, order_by and window expressions use the new Ecto.Query.ByExpr struct rather than the old Ecto.Query.QueryExpr struct" [Ecto.Query] Subqueries are now supported in distinct, group_by, order_by and window expressions

The ByExpr struct is similar to the QueryExpr struct, but has an additional field for subqueries.

The Jamdb.Oracle.Query module uses the QueryExpr struct for the distinct, group_by, and order_by functions. This causes a "no function clause matches" type of error because ecto 3.12.0 and above passes a ByExpr struct instead of a QueryExpr strict. Replacing QueryExpr with ByExpr in these functions gets the queries working again.

Example "defp distinct(%QueryExpr{expr: []}, _, _), do: {[], []}" becomes "defp distinct(%ByExpr{expr: []}, _, _), do: {[], []}"

ByExpr needs to be added to the Jamedb.Oracle.Query module's alias line. alias Ecto.Query.{BooleanExpr, JoinExpr, QueryExpr, WithExpr, ByExpr}

I didn't check the database window functions, but they will probably require the same change.

twister3454 avatar Aug 29 '24 14:08 twister3454