#At file:///mnt/sda7/work/53034-5.1-bugteam/ based on revid:mattias.jonsson@stripped
3486 Gleb Shchepa 2010-08-26
Bug #53034: Multiple-table DELETE statements not accepting
"Access compatibility" syntax
The "wild" "DELETE FROM table_name.* ... USING ..." syntax
for multi-table DELETE statements is documented but it was
lost in the fix for the bug 30234.
The table_ident_opt_wild parser rule has been added
to restore the lost syntax.
@ mysql-test/r/delete.result
Test case for bug #53034.
@ mysql-test/t/delete.test
Test case for bug #53034.
@ sql/sql_yacc.yy
Bug #53034: Multiple-table DELETE statements not accepting
"Access compatibility" syntax
The table_ident_opt_wild parser rule has been added
to restore the lost syntax.
modified:
mysql-test/r/delete.result
mysql-test/t/delete.test
sql/sql_yacc.yy
=== modified file 'mysql-test/r/delete.result'
--- a/mysql-test/r/delete.result 2010-05-14 11:36:27 +0000
+++ b/mysql-test/r/delete.result 2010-08-26 17:43:07 +0000
@@ -358,4 +358,14 @@ INDEX(a), INDEX(b), INDEX(c));
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
DROP TABLE t1;
+#
+# Bug #53034: Multiple-table DELETE statements not accepting
+# "Access compatibility" syntax
+#
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+DELETE FROM t1.*, test.t2.*, .t3.* USING t1, t2, t3;
+DELETE FROM a1.*, test.a2.*, .a3.* USING t1 AS a1, t2 AS a2, t3 AS a3;
+DROP TABLE IF EXISTS t1, t2, t3;
End of 5.1 tests
=== modified file 'mysql-test/t/delete.test'
--- a/mysql-test/t/delete.test 2010-05-14 11:36:27 +0000
+++ b/mysql-test/t/delete.test 2010-08-26 17:43:07 +0000
@@ -387,4 +387,18 @@ DELETE FROM t1 WHERE a = 10 OR b = 20 OR
DROP TABLE t1;
+--echo #
+--echo # Bug #53034: Multiple-table DELETE statements not accepting
+--echo # "Access compatibility" syntax
+--echo #
+
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+
+DELETE FROM t1.*, test.t2.*, .t3.* USING t1, t2, t3;
+DELETE FROM a1.*, test.a2.*, .a3.* USING t1 AS a1, t2 AS a2, t3 AS a3;
+
+DROP TABLE IF EXISTS t1, t2, t3;
+
--echo End of 5.1 tests
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2010-08-18 04:56:06 +0000
+++ b/sql/sql_yacc.yy 2010-08-26 17:43:07 +0000
@@ -1297,6 +1297,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%type <table>
table_ident table_ident_nodb references xid
+ table_ident_opt_wild
%type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password
@@ -9622,7 +9623,7 @@ table_alias_ref_list:
;
table_alias_ref:
- table_ident
+ table_ident_opt_wild
{
if (!Select->add_table_to_list(YYTHD, $1, NULL,
TL_OPTION_UPDATING | TL_OPTION_ALIAS,
@@ -11405,6 +11406,28 @@ table_ident:
}
;
+table_ident_opt_wild:
+ ident opt_wild
+ {
+ $$= new Table_ident($1);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | ident '.' ident opt_wild
+ {
+ $$= new Table_ident(YYTHD, $1,$3,0);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | '.' ident opt_wild
+ {
+ /* For Delphi */
+ $$= new Table_ident($2);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ ;
+
table_ident_nodb:
ident
{
Attachment: [text/bzr-bundle] bzr/gshchepa@mysql.com-20100826174307-ky7aol0pidaberou.bundle