mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed a bug in key optimizing handling where the expression
WHERE column_name = key_column_name was calculated as true for NULL values. Docs/manual.texi: Changelog mysql-test/r/distinct.result: Updated results caused by bug fix. mysql-test/r/null_key.result: New tests mysql-test/t/null_key.test: New tests sql/sql_select.cc: Additional change for previous changeset for using BLOB in GROUP BY
This commit is contained in:
@ -128,7 +128,7 @@ a
|
||||
1
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
|
||||
t3 ref a a 5 t1.a 10 Using index; Distinct
|
||||
t3 ref a a 5 t1.a 10 where used; Using index; Distinct
|
||||
a
|
||||
1
|
||||
2
|
||||
|
@ -120,3 +120,9 @@ id uniq_id
|
||||
4 2
|
||||
7 3
|
||||
8 4
|
||||
order_id product_id product_type
|
||||
order_id product_id product_type
|
||||
3d7ce39b5d4b3e3d22aaafe9b633de51 1206029 3
|
||||
3d7ce39b5d4b3e3d22aaafe9b633de51 5880836 3
|
||||
id id
|
||||
id id
|
||||
|
@ -91,3 +91,47 @@ DELETE FROM t2 WHERE uniq_id IS NULL;
|
||||
SELECT * FROM t1 ORDER BY uniq_id, id;
|
||||
SELECT * FROM t2 ORDER BY uniq_id, id;
|
||||
DROP table t1,t2;
|
||||
|
||||
#
|
||||
# This crashed MySQL 3.23.47
|
||||
#
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`order_id` char(32) NOT NULL default '',
|
||||
`product_id` char(32) NOT NULL default '',
|
||||
`product_type` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
|
||||
) TYPE=MyISAM;
|
||||
CREATE TABLE `t2` (
|
||||
`order_id` char(32) NOT NULL default '',
|
||||
`product_id` char(32) NOT NULL default '',
|
||||
`product_type` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`order_id`,`product_id`,`product_type`)
|
||||
) TYPE=MyISAM;
|
||||
INSERT INTO t1 (order_id, product_id, product_type) VALUES
|
||||
('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3),
|
||||
('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3),
|
||||
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
|
||||
INSERT INTO t2 (order_id, product_id, product_type) VALUES
|
||||
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
|
||||
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id=NULL;
|
||||
select t1.* from t1
|
||||
left join t2 using(order_id, product_id, product_type)
|
||||
where t2.order_id is NULL;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# The last select returned wrong results in 3.23.52
|
||||
#
|
||||
|
||||
create table t1 (id int);
|
||||
insert into t1 values (null), (0);
|
||||
create table t2 (id int);
|
||||
insert into t2 values (null);
|
||||
select * from t1, t2 where t1.id = t2.id;
|
||||
alter table t1 add key id (id);
|
||||
select * from t1, t2 where t1.id = t2.id;
|
||||
drop table t1,t2;
|
||||
|
Reference in New Issue
Block a user