[MDEV-18511] CTE support for UPDATE and DELETE statements Created: 2019-02-08 Updated: 2024-01-30 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Optimizer, Optimizer - CTE |
| Fix Version/s: | 11.6 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Daniel Black | Assignee: | Igor Babaev |
| Resolution: | Unresolved | Votes: | 10 |
| Labels: | gsoc19, gsoc20, upstream-fixed | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Sub-Tasks: |
|
||||||||||||||||||||||||||||
| Description |
|
supported in MySQL-8.0 and MSSQL |
| Comments |
| Comment by Emily Bowman [ 2020-01-24 ] | ||||||||||||||||||||||||||||||||||||
|
This needs to be called out in the documentation for UPDATE & DELETE. Coming from a MySQL project to MariaDB I expected this to work and banged my head on it for an hour, before a lucky Stack Overflow find led me to this bug. Fortunately I have permission to create & drop temporary tables, but not everyone will. | ||||||||||||||||||||||||||||||||||||
| Comment by Rahul Anand [ 2020-03-03 ] | ||||||||||||||||||||||||||||||||||||
|
Hi Igor, Also, I was not able to find you on zulip and was wondering which form of communication would be most suitable for you regarding this project? | ||||||||||||||||||||||||||||||||||||
| Comment by Rahul Anand [ 2020-06-08 ] | ||||||||||||||||||||||||||||||||||||
|
8th July 2020 Report – Updatability of tests in main.view with merging allowed for multi-update. https://www.notion.so/8-June-2020-02635b89b39842bc97121105c05ac7d1 All reports can be seen here: | ||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2020-08-22 ] | ||||||||||||||||||||||||||||||||||||
|
To add <with clauses> to UPDATE/DELETE statements in the grammar is an easy task. Yet processing UPDATE/DELETE statements with CTEs at the top level is not easy for the following reasons.
When a multi-table UPDATE statement does not update the used mergeable derived table the table is still materialized.
We don't have such problems with mergeable views:
So it's quite possible to merge the mergeable derived tables used at the top level of UPDATE/DELETE statements rather then materialize them. | ||||||||||||||||||||||||||||||||||||
| Comment by Thierry Giguere [ 2022-10-17 ] | ||||||||||||||||||||||||||||||||||||
|
I'm not sure to understand but the following works for sure in MariaDb 10.6.10 UPDATE tree t, SELECT * FROM tree; Node ParentNode EmployeeID Depth Lineage Is it a supported syntax ? What is the difference with the SQL at the center of the discussion ? Only the fact that CTE is "outside" the update statement ? | ||||||||||||||||||||||||||||||||||||
| Comment by Valerii Kravchuk [ 2023-04-12 ] | ||||||||||||||||||||||||||||||||||||
|
Is 10.11 as a fix version still correct? Now that we have 10.11.2 released as GA: | ||||||||||||||||||||||||||||||||||||
| Comment by Ralf Gebhardt [ 2023-04-13 ] | ||||||||||||||||||||||||||||||||||||
|
valerii no, it is not. psergei and igor, can you estimate how much work is still needed to get this task done? I will change the status to stalled for now and will remove the fixVersion until we have a better idea about the task/open effort. It does not make sense to just add 11.2 as fixVersion for now, as this does not seem to be realistic |