Closed derekperkins closed 7 months ago
EDIT: This is wrong. Read the next comment.
Hi @derekperkins!
Thanks for the writeup. I don't think the problem here is with the ambigous column names, since in the ORDER BY you are wrapping the column with MIN
. I think the problem is that MySQL has much better support for functional dependencies than Vitess has. https://dev.mysql.com/doc/refman/8.2/en/group-by-functional-dependence.html
Thanks to this, MySQL can see that {min(deadline_at)} -> {from_unixtime(min(deadline_at))}
, to borrow the notation from that page.
This is not going to be straight forward to implement. As a work-around, I'm pretty sure that changing the query to use order by deadline_at
will give you the same results and not be a problem for the column binder.
Hmmm... Reading and experimenting more, I think you were actually totally correct in your assessment of the issue. Working on solving it in https://github.com/vitessio/vitess/pull/14935
Thanks @systay! We changed the query alias to make it work when I reported it, so we're in no rush
Overview of the Issue
We have a query that was using the v3 query planner comment directive that broke when upgrading to v18, with that removal. Vitess isn't handling an ambiguous column alias in the
ORDER BY
clause the same way MySQL does.vttablet: rpc error: code = InvalidArgument desc = Invalid use of group function (errno 1111) (sqlstate HY000)
Possibly related issue:
Reproduction Steps
Unsharded keyspace
The query above works if you change the column alias to
deadline_at2
or anything that doesn't shadow the original column name.Binary Version
Operating System and Environment details
Log Fragments
No response