MySQL 8.0.22 のリリースノートによるとプリペアドステートメントまわりに非互換があるらしい。
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html
For a prepared statement of the form SELECT expr1, expr2, ... FROM table ORDER BY ?, passing an integer value N for the parameter no longer causes ordering of the results by the Nth expression in the select list; the results are no longer ordered, as is expected with ORDER BY constant.
order by の引数をプレースホルダで与えても無視されるらしい。
試してみる。
8.0.21:
% docker run -p 13306:3306 --name mysql8021 -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:8.0.21 % docker exec -it mysql8021 mysql mysql> create database test; mysql> use test; mysql> create table t (id int …[さらに読む]