1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

fixed * without tables in IN bug

fixed sunction-test select in IN bug
fixed unions in subselect bug
This commit is contained in:
bell@sanja.is.com.ua
2002-11-28 19:29:26 +02:00
parent d2e5a5ddd2
commit b8b7d0b03b
35 changed files with 199 additions and 39 deletions

View File

@ -513,3 +513,30 @@ x y
4 2
2 1
drop table t1, t2;
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT *);
No tables used
drop table if exists t;
CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t VALUES (1),(2);
SELECT * FROM t WHERE id IN (SELECT 1);
id
1
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t ref id id 5 const 1 Using where; Using index
Warnings:
Note 1246 Select 2 was reduced during optimisation
SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
id
1
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t index NULL id 5 NULL 2 Using where; Using index
2 DEPENDENT SUBSELECT No tables used
3 UNION No tables used
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3);
id
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
drop table if exists t;

View File

@ -306,3 +306,17 @@ select * from t1;
replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
select * from t1;
drop table t1, t2;
-- error 1096
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT *);
drop table if exists t;
CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t VALUES (1),(2);
SELECT * FROM t WHERE id IN (SELECT 1);
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1);
SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3);
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3);
SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2);
drop table if exists t;