I have detected a query that contains subqueries with joins, concats and cases statements that generates spurious results.
The problem is that the field computed by the CONCAT statement is living a bug related to the string management, overflow or something similar that causes outputs as the contained in the result.txt attached file.
I have attached 4 files:
- saltos.sql => contains a minimum schema and sufficient data to reproduce the issue.
- query.sql => contains a simple query able to demostrate the problem.
- result.txt => contains the result of execute the query.sql into saltos.sql.
- expected.txt => contains the expected result.
As a note:
If you remove the WHERE statement or replace the "d.id id_usuario" by "e.id_usuario id_usuario" in the fields zone of the SELECT, then you get the expected result.
I have tryed other versions of MariaDB. I have reproduced the issue in the follows releases: 10.1.14, 10.1.16, 10.1.21, 10.1.22 and 10.1.23