summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-02-15 21:03:17 -0800
committerunknown <igor@rurik.mysql.com>2005-02-15 21:03:17 -0800
commit968e06a8040f87527ca54035b4e07ee69eda6083 (patch)
treef7e7b5491b05505e760919786421c7385a3a7e0b
parent69a6d4da0b778d231396a40ac9d696b9f0dacc27 (diff)
parentd6157becb314900350d6f5589eaca7ce85741acf (diff)
downloadmariadb-git-968e06a8040f87527ca54035b4e07ee69eda6083.tar.gz
Manual merge
mysql-test/t/delete.test: Auto merged sql/sql_delete.cc: Auto merged
-rw-r--r--mysql-test/r/delete.result9
-rw-r--r--mysql-test/t/delete.test11
-rw-r--r--sql/sql_delete.cc1
3 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index f1fba87c70b..411cd52b4ca 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -163,3 +163,12 @@ select * from t1;
a b
7 7
drop table t1;
+CREATE TABLE t1 ( a int PRIMARY KEY );
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
+INSERT INTO t1 VALUES (0),(1),(2);
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
+SELECT * FROM t1;
+a
+0
+2
+DROP TABLE t1;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 0bf7187865d..a6335d77a0c 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -141,3 +141,14 @@ delete t1 from t1 where a = 3;
check table t1;
select * from t1;
drop table t1;
+
+#
+# Bug #8392: delete with ORDER BY containing a direct reference to the table
+#
+
+CREATE TABLE t1 ( a int PRIMARY KEY );
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
+INSERT INTO t1 VALUES (0),(1),(2);
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 8b4a0f0f6d0..cecdf8d1c62 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -117,6 +117,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
bzero((char*) &tables,sizeof(tables));
tables.table = table;
+ tables.alias = table_list->alias;
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));