mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-33988 DELETE single table to support table aliases
Gain MySQL compatibility by allowing table aliases in a single table statement. This now supports the syntax of: DELETE [delete_opts] FROM tbl_name [[AS] tbl_alias] [PARTITION (partition_name [, partition_name] ...)] .... The delete.test is from MySQL commit 1a72b69778a9791be44525501960b08856833b8d / Change-Id: Iac3a2b5ed993f65b7f91acdfd60013c2344db5c0. Co-Author: Gleb Shchepa <gleb.shchepa@oracle.com> (for delete.test) Reviewed by Igor Babaev (igor@mariadb.com)
This commit is contained in:
@ -668,3 +668,26 @@ select *from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 11.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33988 DELETE to support table aliases
|
||||
--echo #
|
||||
# Test from MySQL Bug#27455809; DELETE FROM ...WHERE NOT EXISTS WITH TABLE ALIAS CREATES AN ERROR 1064 (42000
|
||||
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
SELECT * FROM t1;
|
||||
|
||||
DELETE FROM t1 AS a1 WHERE a1.c1 = 2;
|
||||
SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t2 (c2 INT);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
SELECT * FROM t2;
|
||||
|
||||
DELETE FROM t2 a2 WHERE NOT EXISTS (SELECT * FROM t1 WHERE t1.c1 = a2.c2);
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 11.6 tests
|
||||
|
Reference in New Issue
Block a user