diff options
author | unknown <gshchepa/uchum@gleb.loc> | 2007-06-24 01:20:14 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gleb.loc> | 2007-06-24 01:20:14 +0500 |
commit | 1bab1ddc553f5ccb836488e473ddcc09e9e77b7d (patch) | |
tree | e0bb0b4cc327851f8b5c0f9b252abd924c24c499 /mysql-test/t/insert_select.test | |
parent | f77d416821d99fd8a195b51206f3c4dd56db3ca9 (diff) | |
download | mariadb-git-1bab1ddc553f5ccb836488e473ddcc09e9e77b7d.tar.gz |
Fixed bug #29095.
INSERT into table from SELECT from the same table
with ORDER BY and LIMIT was inserting other data
than sole SELECT ... ORDER BY ... LIMIT returns.
One part of the patch for bug #9676 improperly pushed
LIMIT to temporary table in the presence of the ORDER BY
clause.
That part has been removed.
sql/sql_select.cc:
Fixed bug #29095.
One part of the patch for bug #9676 improperly pushed
LIMIT to temporary table in the presence of the ORDER BY
clause.
That part has been removed.
mysql-test/t/insert_select.test:
Expanded the test case for bug #9676.
Created a test case for bug #29095.
mysql-test/r/insert_select.result:
Expanded the test case for bug #9676.
Created a test case for bug #29095.
Diffstat (limited to 'mysql-test/t/insert_select.test')
-rw-r--r-- | mysql-test/t/insert_select.test | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index bbc51be6dc9..bf6dae96847 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -233,7 +233,9 @@ drop table t1,t2; CREATE TABLE t1 (a int PRIMARY KEY); INSERT INTO t1 values (1), (2); +flush status; INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; +show status like 'Handler_read%'; DROP TABLE t1; @@ -332,3 +334,26 @@ INSERT INTO t2 (d) SELECT * FROM t2; DROP TABLE t1,t2; + +# +# Bug #29095: incorrect pushing of LIMIT into the temporary +# table ignoring ORDER BY clause +# + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + prev_id INT, + join_id INT DEFAULT 0); + +INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2); +SELECT * FROM t1; + +CREATE TABLE t2 (join_id INT); +INSERT INTO t2 (join_id) VALUES (0); + +INSERT INTO t1 (prev_id) SELECT id + FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id + ORDER BY id DESC LIMIT 1; +SELECT * FROM t1; + +DROP TABLE t1,t2; |