mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed bug mdev-11608.
The fix for bug mdev-11488 introduced the virtual method convert_to_basic_const_item for the class Item_cache. The implementation of this method for the class Item_cache_str was not quite correct: the server could crash if the cached item was null. A similar problem could appear for the implementation of this method for the class Item_cache_decimal. Although I could not reproduce the problem I decided to change the code appropriately.
This commit is contained in:
@ -1289,3 +1289,33 @@ SELECT * FROM v1 WHERE NULLIF(1, i);
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11608: pushdown of the predicate with cached null value
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c VARCHAR(3));
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES ('foo'),('bar');
|
||||
|
||||
CREATE TABLE t2 (c VARCHAR(3));
|
||||
INSERT INTO t2 VALUES ('foo'),('xyz');
|
||||
|
||||
SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 );
|
||||
EXPLAIN FORMAT=JSON
|
||||
SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 );
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (d DECIMAL(10,2));
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (5.37),(1.1);
|
||||
|
||||
CREATE TABLE t2 (d DECIMAL(10,2));
|
||||
INSERT INTO t2 VALUES ('1.1'),('2.23');
|
||||
|
||||
SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 );
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
Reference in New Issue
Block a user