Skip to content

Commit

Permalink
[MySQL] Allow using of alias in single delete statement (#3297)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfvitale committed Mar 23, 2023
1 parent 477b761 commit bcc9a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sql/mysql/Positive-Technologies/MySqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ lockClause

singleDeleteStatement
: DELETE priority=LOW_PRIORITY? QUICK? IGNORE?
FROM tableName
FROM tableName (AS? uid)?
(PARTITION '(' uidList ')' )?
(WHERE expression)?
orderByClause? (LIMIT limitClauseAtom)?
Expand Down
5 changes: 5 additions & 0 deletions sql/mysql/Positive-Technologies/examples/dml_delete.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ DELETE t1 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.id IS NULL;
DELETE a1, a2 FROM t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id;
DELETE FROM a1, a2 USING t1 AS a1 INNER JOIN t2 AS a2 WHERE a1.id=a2.id;
#end
#begin
-- delete with table alias
DELETE FROM t1 alias_t1 WHERE alias_t1.col1 > 0;
DELETE FROM t1 as alias_t1 WHERE alias_t1.col1 > 0;
#end

0 comments on commit bcc9a89

Please sign in to comment.