mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #25798.
This bug may manifest itself not only with the queries for which the index-merge access method is chosen. It also may display itself for queries with DISTINCT. The bug was in how the Unique::get method used the merge_buffers function. To compare elements in the the queue employed by merge_buffers() it must use the buffpek_compare function rather than the function for binary comparison.
This commit is contained in:
@ -676,4 +676,55 @@ INSERT INTO t1 VALUES (1);
|
||||
switch to connection default
|
||||
SET AUTOCOMMIT=default;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id int NOT NULL auto_increment PRIMARY KEY,
|
||||
b int NOT NULL,
|
||||
c datetime NOT NULL,
|
||||
INDEX idx_b(b),
|
||||
INDEX idx_c(c)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
b int NOT NULL auto_increment PRIMARY KEY,
|
||||
c datetime NOT NULL
|
||||
) ENGINE= MyISAM;
|
||||
INSERT INTO t2(c) VALUES ('2007-01-01');
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t2(c) SELECT c FROM t2;
|
||||
INSERT INTO t1(b,c) SELECT b,c FROM t2;
|
||||
UPDATE t2 SET c='2007-01-02';
|
||||
INSERT INTO t1(b,c) SELECT b,c FROM t2;
|
||||
UPDATE t2 SET c='2007-01-03';
|
||||
INSERT INTO t1(b,c) SELECT b,c FROM t2;
|
||||
set @@sort_buffer_size=8192;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
3072
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t1
|
||||
WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL idx_b,idx_c NULL NULL NULL 3263 Using where
|
||||
SELECT COUNT(*) FROM t1
|
||||
WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
|
||||
COUNT(*)
|
||||
3072
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
|
||||
WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge idx_b,idx_c idx_c,idx_b 8,4 NULL 3262 Using sort_union(idx_c,idx_b); Using where
|
||||
SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
|
||||
WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1;
|
||||
COUNT(*)
|
||||
3072
|
||||
set @@sort_buffer_size=default;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user