[MDEV-13436] PREPARE doesn't work as expected & throws errors but MySQL is working fine Created: 2017-08-03 Updated: 2017-09-11 Resolved: 2017-09-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery, Prepared Statements, Views |
| Affects Version/s: | 10.2.7, 10.2 |
| Fix Version/s: | 10.2.9, 10.3.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Ralf Niedermayer | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | optimizer | ||
| Environment: |
Windows 2008R2 64 Bit und Windows 7 64 Bit |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
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. The error messages are included in the examples. |
| Comments |
| Comment by Elena Stepanova [ 2017-08-04 ] | |||||||||||||||||||||||||
|
Thanks for the report and test cases. With 10.1, neither of the queries is expected to work anyway, so I'm removing it from the affected versions; but with 10.2, both should work, so it appears to be a bug indeed. Here are the test cases from the attachments (for convenience):
| |||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-09-06 ] | |||||||||||||||||||||||||
|
First case have nothing to do with MAX, max only prevent to get rid of the subquery, here is other example where it fails:
the real problem incorrect print of subquery probably because of incorrect mode or because of something triggered optimisation. | |||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-09-07 ] | |||||||||||||||||||||||||
|
Second test suite is a bug in CTE so I put it separate. | |||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-09-07 ] | |||||||||||||||||||||||||
|
revision-id: 0e931867fd540123679f8af7da0ddf9bd351d546 (mariadb-10.2.8-52-g0e931867fd5)
Now we allow derived in the from clause of subqueries so set — | |||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-09-07 ] | |||||||||||||||||||||||||
|
github tree bb-10.2- | |||||||||||||||||||||||||
| Comment by Igor Babaev [ 2017-09-10 ] | |||||||||||||||||||||||||
|
It's ok to push this patch. |