diff options
author | unknown <igor@rurik.mysql.com> | 2005-02-15 18:48:04 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2005-02-15 18:48:04 -0800 |
commit | d6157becb314900350d6f5589eaca7ce85741acf (patch) | |
tree | eaa9281ab9fd88fa6052d116fae495d4274f749a | |
parent | c7b5773551ba41abda521f1b6e592258252431ee (diff) | |
parent | f1a97c0c49d1193bf37f36b27e968b4185165645 (diff) | |
download | mariadb-git-d6157becb314900350d6f5589eaca7ce85741acf.tar.gz |
Merge rurik.mysql.com:/home/igor/mysql-4.0
into rurik.mysql.com:/home/igor/dev/mysql-4.0-0
-rw-r--r-- | mysql-test/r/delete.result | 9 | ||||
-rw-r--r-- | mysql-test/t/delete.test | 11 | ||||
-rw-r--r-- | sql/sql_delete.cc | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 7353e687ae7..378371f2982 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -61,3 +61,12 @@ select * from t1; a b 1 apple 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 07cb9155b3f..5fcdd6263ed 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -71,3 +71,14 @@ select * from t1; delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; 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 92193e3abf2..475df34dc4f 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -111,6 +111,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, bzero((char*) &tables,sizeof(tables)); tables.table = table; + tables.alias = table_list->alias; table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), MYF(MY_FAE | MY_ZEROFILL)); |