In some cases (see attached files for two simple examples) an SQL query with PREPARE gives me an error message instead of a result set. I think this queries should work and if I execute the exact same queries on MySQL 5.7.18 (subselect example) or MySQL 8.0.2 (subselect and CTE examples) it is working fine and as excepted. So I think there may be an Bug with MariaDB?
This occurs only with PREPARE. If I'm running this directly (without PREPARE) it is working fine too with MariaDB.
If I change the "max(1)" to "ceil(1)" in my subselect example it is working fine altogether (PREPARE and MariaDB).
The error messages are included in the examples.
It would be nice if you can double check my examples and maybe fix it in a future version?