mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#50389 Using intersect does not return all rows
In process of record search it is not taken into account that inital quick->file->ref value could be inapplicable to range interval. After proper row is found this value is stored into the record buffer and later the record is filtered out at condition evaluation stage. The fix is store a refernce of found row to the handler ref field. mysql-test/r/innodb_mysql.result: test case mysql-test/std_data/intersect-bug50389.tsv: test case mysql-test/t/innodb_mysql.test: test case sql/opt_range.cc: store a refernce of found row to the handler ref field.
This commit is contained in:
@ -2417,4 +2417,42 @@ ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0, 77, 1, 3);
|
||||
UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#50389 Using intersect does not return all rows
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
f1 INT(10) NOT NULL,
|
||||
f2 INT(10),
|
||||
f3 INT(10),
|
||||
f4 TINYINT(4),
|
||||
f5 VARCHAR(50),
|
||||
PRIMARY KEY (f1),
|
||||
KEY idx1 (f2,f5,f4),
|
||||
KEY idx2 (f2,f4)
|
||||
) ENGINE=InnoDB;
|
||||
LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
|
||||
SELECT * FROM t1 WHERE f1 IN
|
||||
(3305028,3353871,3772880,3346860,4228206,3336022,
|
||||
3470988,3305175,3329875,3817277,3856380,3796193,
|
||||
3784744,4180925,4559596,3963734,3856391,4494153)
|
||||
AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
|
||||
f1 f2 f3 f4 f5
|
||||
3305175 1221457 0 0 abcdefghijklmnopwrst
|
||||
3329875 1221457 1382427 0 abcdefghijklmnopwrst
|
||||
3336022 1221457 0 0 abcdefghijklmnopwrst
|
||||
3346860 1221457 0 0 abcdefghijklmnopwrst
|
||||
3772880 1221457 0 0 abcdefghijklmnopwrst
|
||||
3784744 1221457 1382427 0 abcdefghijklmnopwrst
|
||||
3796193 1221457 0 0 abcdefghijklmnopwrst
|
||||
4228206 1221457 0 0 abcdefghijklmnopwrst
|
||||
4494153 1221457 0 0 abcdefghijklmnopwrst
|
||||
4559596 1221457 0 0 abcdefghijklmnopwrst
|
||||
EXPLAIN SELECT * FROM t1 WHERE f1 IN
|
||||
(3305028,3353871,3772880,3346860,4228206,3336022,
|
||||
3470988,3305175,3329875,3817277,3856380,3796193,
|
||||
3784744,4180925,4559596,3963734,3856391,4494153)
|
||||
AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user