if I change mdev_29008.test to use ORDER BY without aliases to an aggregate function, like
Then I can see that the spider will generate the query
which is clearly wrong, it doesn't distinguish between min and max. It needs to auto-generate names for aggregates as needed.
Also might apply to HAVING