[MDEV-6163] Error while executing an update query that has the same table in a sub-query Created: 2014-04-24 Updated: 2015-11-03 Resolved: 2014-06-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.3.12, 5.5.37, 10.0.10 |
| Fix Version/s: | 5.5.38, 10.0.12 |
| Type: | Bug | Priority: | Major |
| Reporter: | sandeep | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream | ||
| Description |
|
The following update query gives error 1093 in MariaDB 10.0.10 but the same query works fine with MySQL 5.1.53-community version. Query:
Result:
Sample table:
It appears that same table inside a sub-query is not supported in MariaDB version 10.0.10 |
| Comments |
| Comment by Elena Stepanova [ 2014-04-25 ] | |||||||||||||||
|
Hi, As a workaround, please try to set | |||||||||||||||
| Comment by Elena Stepanova [ 2014-04-25 ] | |||||||||||||||
|
Reproducible on MariaDB 5.3-10.0 with subqueries, and everywhere (MySQL 5.1-5.7, MariaDB 5.1-10.0) with MERGE views. Test case with a subquery:
Test case with a MERGE view:
| |||||||||||||||
| Comment by Oleksandr Byelkin [ 2014-05-08 ] | |||||||||||||||
|
Sent for review | |||||||||||||||
| Comment by Evgenii [ 2015-11-03 ] | |||||||||||||||
|
Dear All, This issue is not resolved. It was checked on MariaDB versions: 10.0.19 and 10.1.8. Below you can find the script for recreating of situation:
Error:
The values of optimizer_switch:
Best, | |||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-11-03 ] | |||||||||||||||
|
You case is quite different. Original test case was about table of subquery in the FROM clause (derived table). Your problem is not solved in MySQL nor mariaDB. If you really need it please fill separate bug report/feature request. But I doubts that it will be fixed soon in both servers. Workaround is to put z_temp_tbl in materialized view or derived table to force it materialization before query execution: update z_temp_tbl set txt_val='t' where tbl_id = (select * from (select max(tbl_id) from z_temp_tbl) as max); | |||||||||||||||
| Comment by Evgenii [ 2015-11-03 ] | |||||||||||||||
|
Dear Oleksandr, Thank you for prompt answer. Best. |