mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for #1992
This bug happens when a query, having subselects in the fields list, needs temporary table. Item_subselect::get_tmp_table_item isn't implemented and just returns *this. So the tmp_table_item takes value not from temporary but from original table. mysql-test/r/subselect.result: appropriate test result added mysql-test/t/subselect.test: test case added sql/item_subselect.cc: Item_subselect::get_tmp_table_item implementation sql/item_subselect.h: Item_subselect::get_tmp_table_item declaration
This commit is contained in:
@ -1569,3 +1569,13 @@ INSERT INTO t2 VALUES (100, 200, 'C');
|
||||
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
|
||||
COLC
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a int(1));
|
||||
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
|
||||
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
|
||||
(SELECT a)
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
|
@ -1009,3 +1009,8 @@ INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
|
||||
INSERT INTO t2 VALUES (100, 200, 'C');
|
||||
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
CREATE TABLE t1 (a int(1));
|
||||
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
|
||||
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user