mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed wrong range test code for HEAP tables. This caused a crash when doing a range test with a key that didn't have lower or upper bound (Bug #6082)
More test cases mysql-test/r/heap.result: Test for bug #6082 (delete with NOT NULL) mysql-test/r/key.result: More tests for BUG#6151 - myisam index corruption mysql-test/r/ps.result: Test of bug #6047 "Permission problem when executing mysql_stmt_execute with derived table" mysql-test/t/heap.test: Test for bug #6082 (delete with NOT NULL) mysql-test/t/key.test: More tests for BUG#6151 - myisam index corruption mysql-test/t/ps.test: Test of bug #6047 "Permission problem when executing mysql_stmt_execute with derived table" sql/ha_heap.cc: Fixed wrong range test code for HEAP tables. This caused a crash when doing a range test with a key that didn't have lower or upper bound
This commit is contained in:
@ -227,3 +227,9 @@ SELECT MAX(job_title_id) FROM job_titles;
|
|||||||
MAX(job_title_id)
|
MAX(job_title_id)
|
||||||
NULL
|
NULL
|
||||||
DROP TABLE job_titles;
|
DROP TABLE job_titles;
|
||||||
|
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
|
||||||
|
INSERT INTO t1 VALUES(1,1), (1,NULL);
|
||||||
|
SELECT * FROM t1 WHERE B is not null;
|
||||||
|
a B
|
||||||
|
1 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -296,4 +296,12 @@ Table Op Msg_type Msg_text
|
|||||||
test.t1 check status OK
|
test.t1 check status OK
|
||||||
select c1 from t1 where c2='\Z\Z\Z\Z';
|
select c1 from t1 where c2='\Z\Z\Z\Z';
|
||||||
c1
|
c1
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
|
||||||
|
delete from t1 where c1=3;
|
||||||
|
delete from t1 where c1=1;
|
||||||
|
delete from t1 where c1=4;
|
||||||
|
check table t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 check status OK
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -450,3 +450,9 @@ found_rows()
|
|||||||
10
|
10
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (N int, M tinyint);
|
||||||
|
INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
|
||||||
|
PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -164,3 +164,13 @@ CREATE TABLE `job_titles` (
|
|||||||
SELECT MAX(job_title_id) FROM job_titles;
|
SELECT MAX(job_title_id) FROM job_titles;
|
||||||
|
|
||||||
DROP TABLE job_titles;
|
DROP TABLE job_titles;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test of delete with NOT NULL
|
||||||
|
# (Bug #6082)
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
|
||||||
|
INSERT INTO t1 VALUES(1,1), (1,NULL);
|
||||||
|
SELECT * FROM t1 WHERE B is not null;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -272,5 +272,16 @@ select c1 from t1 where c2='\Z\Z\Z\Z';
|
|||||||
DELETE FROM t1 WHERE (c1 = 3);
|
DELETE FROM t1 WHERE (c1 = 3);
|
||||||
check table t1;
|
check table t1;
|
||||||
select c1 from t1 where c2='\Z\Z\Z\Z';
|
select c1 from t1 where c2='\Z\Z\Z\Z';
|
||||||
|
|
||||||
|
#
|
||||||
|
# test delete of keys in a different order
|
||||||
|
#
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
|
||||||
|
delete from t1 where c1=3;
|
||||||
|
delete from t1 where c1=1;
|
||||||
|
delete from t1 where c1=4;
|
||||||
|
check table t1;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
@ -449,3 +449,16 @@ execute stmt;
|
|||||||
select found_rows();
|
select found_rows();
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#6047 "permission problem when executing mysql_stmt_execute with derived
|
||||||
|
# table"
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (N int, M tinyint);
|
||||||
|
INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
|
||||||
|
PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -378,7 +378,8 @@ ha_rows ha_heap::records_in_range(uint inx, key_range *min_key,
|
|||||||
if (key->algorithm == HA_KEY_ALG_BTREE)
|
if (key->algorithm == HA_KEY_ALG_BTREE)
|
||||||
return hp_rb_records_in_range(file, inx, min_key, max_key);
|
return hp_rb_records_in_range(file, inx, min_key, max_key);
|
||||||
|
|
||||||
if (min_key->length != max_key->length ||
|
if (!min_key || !max_key ||
|
||||||
|
min_key->length != max_key->length ||
|
||||||
min_key->length != key->key_length ||
|
min_key->length != key->key_length ||
|
||||||
min_key->flag != HA_READ_KEY_EXACT ||
|
min_key->flag != HA_READ_KEY_EXACT ||
|
||||||
max_key->flag != HA_READ_AFTER_KEY)
|
max_key->flag != HA_READ_AFTER_KEY)
|
||||||
|
Reference in New Issue
Block a user