mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
range.result, range.test:
Added a test case for bug #10031. opt_range.cc: Fixed bug #10031: range condition was not used with views. Range analyzer did not take into account that view columns were always referred through Item_ref.
This commit is contained in:
@ -720,3 +720,27 @@ id status
|
||||
59 C
|
||||
60 C
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, b int, primary key(a,b));
|
||||
INSERT INTO t1 VALUES
|
||||
(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3);
|
||||
CREATE VIEW v1 as SELECT a,b FROM t1 WHERE b=3;
|
||||
EXPLAIN SELECT a,b FROM t1 WHERE a < 2 and b=3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
|
||||
EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
|
||||
EXPLAIN SELECT a,b FROM t1 WHERE a < 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
|
||||
EXPLAIN SELECT a,b FROM v1 WHERE a < 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
|
||||
SELECT a,b FROM t1 WHERE a < 2 and b=3;
|
||||
a b
|
||||
1 3
|
||||
SELECT a,b FROM v1 WHERE a < 2 and b=3;
|
||||
a b
|
||||
1 3
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user