[MDEV-5872] Multi-table DELETE + RETURNING = parse error Created: 2014-03-15  Updated: 2014-03-17  Resolved: 2014-03-17

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.9
Fix Version/s: 10.0.10

Type: Bug Priority: Major
Reporter: Federico Razzoli Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: None


 Description   

This page:

https://mariadb.com/kb/en/delete/

says that the following syntax is supported:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
    tbl_name[.*] [, tbl_name[.*]] ...
    FROM table_references
    [WHERE where_condition]
    [RETURNING select_expr [, select_expr ...]]

But if I use it I get an error:

MariaDB [test]> DELETE post FROM blog INNER JOIN post WHERE blog.id = post.blog_id RETURNING post.title;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RETURNING post.title' at line 1



 Comments   
Comment by Elena Stepanova [ 2014-03-16 ]

I think the documentation is overly optimistic. MDEV-3814 which introduced the new syntax only specifies it for a single table:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
    [WHERE where_condition]
    [ORDER BY col_name | expr | position} [ASC | DESC], ...]
    [LIMIT row_count]
RETURNING select_expr [, select_expr ...]

Comment by Ian Gilfillan [ 2014-03-17 ]

The documentation has been amended.

Generated at Thu Feb 08 07:07:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.