Open twister3454 opened 3 months ago
I compiled my ecto project using the jamdb_oracle master branch. The errors I was getting with group_by, order_by, and distinct are gone. I did not check any cte queries. Thanks.
I'm still getting errors with custom parameterized ecto types that use Ecto.ParameterizedType
. I haven't had time to look into why, though.
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.