elixir-ecto / ecto_sql

SQL-based adapters for Ecto and database migrations
https://hexdocs.pm/ecto_sql
Apache License 2.0
578 stars 312 forks source link

MyXQL: Add back subquery parens inside of function calls #643

Closed greg-rychlewski closed 1 month ago

greg-rychlewski commented 1 month ago

Closes https://github.com/elixir-ecto/ecto_sql/issues/642

This was removed when subquery support was added to order by/group by. I believe it was because stuff like exists((..subquery...)) looked weird and not necessarily because it breaks the query. All my local tests passed and all our integration tests pass, including the ones added when this change was made.

I opted for adding the parens back because the other option is to special case certain functions. Which I think can get hairy.

josevalim commented 1 month ago

Should we add a test with the coalesce example in #642?