Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
twister3454 opened this issue Aug 29, 2024 · 3 comments
Open

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

twister3454 opened this issue Aug 29, 2024 · 3 comments

Comments

@twister3454
Copy link

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.

@vstavskyi
Copy link
Member

commit

@twister3454
Copy link
Author

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.

@sax
Copy link
Contributor

sax commented Sep 19, 2024

I'm still getting errors with custom parameterized ecto types that use Ecto.ParameterizedType. I haven't had time to look into why, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants