avram
avram copied to clipboard
Distinct doesn't work when using upper
# works
UserQuery.new
.preload_role
.where_groups(GroupQuery.new.id.in(groups.map &.id))
.email
.upper
.asc_order
# works
UserQuery.new
.preload_role
.where_groups(GroupQuery.new.id.in(groups.map &.id))
.email
.asc_order
.distinct
# doesn't work (for SELECT DISTINCT, ORDER BY expressions must appear in select list)
UserQuery.new
.preload_role
.where_groups(GroupQuery.new.id.in(groups.map &.id))
.email
.upper
.asc_order
.distinct
Just writing what I've learned...
In order for this to work, you'd have to update the select to include UPPER(user.email) and avram doesn't provide a way to model the selections right now.
That's fine. We can close this issue if there's no plan to change the selection.