mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed LP bug #891953.
Due to this bug the function SEL_IMERGE::or_sel_tree_with_checks() could build an inconsistent merge tree if one of the SEL_TREEs in the resulting index merge happened to contain a full key range. This could trigger an assertion failure.
This commit is contained in:
@ -1427,4 +1427,17 @@ WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||
(t1.c=0 OR t1.a=500);
|
||||
a b c
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY,idx NULL NULL NULL 2 Using where
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
a b
|
||||
167 9999
|
||||
168 10000
|
||||
DROP TABLE t1;
|
||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||
|
@ -1428,5 +1428,18 @@ WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
|
||||
(t1.c=0 OR t1.a=500);
|
||||
a b c
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY,idx PRIMARY 0 NULL 1 Using where
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
a b
|
||||
167 9999
|
||||
168 10000
|
||||
DROP TABLE t1;
|
||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
@ -1074,6 +1074,21 @@ SELECT * FROM t1
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# LP bug #891953: always true OR
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
|
||||
INSERT INTO t1 VALUES (167,9999), (168,10000);
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
SELECT * FROM t1
|
||||
WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#the following command must be the last one in the file
|
||||
set session optimizer_switch='index_merge_sort_intersection=default';
|
||||
|
||||
|
@ -1208,13 +1208,13 @@ int SEL_IMERGE::or_sel_tree_with_checks(RANGE_OPT_PARAM *param,
|
||||
|
||||
if (result)
|
||||
{
|
||||
result->keys_map= result_keys;
|
||||
if (result_keys.is_clear_all())
|
||||
result->type= SEL_TREE::ALWAYS;
|
||||
if ((result->type == SEL_TREE::MAYBE) ||
|
||||
(result->type == SEL_TREE::ALWAYS))
|
||||
return 1;
|
||||
/* SEL_TREE::IMPOSSIBLE is impossible here */
|
||||
result->keys_map= result_keys;
|
||||
*or_tree= result;
|
||||
was_ored= TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user