Regression in 4edad1ddf6203326e0be4bdb105beecb0fe454c4.
Thanks utapyngo for the report.
Backport of bf12273db4e53779546e2ac7b65c0ce8e3c8a640 from master.
Even though good databases tend to keep the result sorted by the/one
window expression and the planners are smart enough to not resort if not
required, it is not valid to rely on this.
MariaDB specifically did return whatever order it wanted, which is
completely okay. Now we sort towards the expected data for all databases.
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.