[MDEV-6910] Item_cache::is_null() returns incorrect result inside storage engine's cond_push() Created: 2014-10-22  Updated: 2022-01-27  Resolved: 2022-01-25

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.0.14
Fix Version/s: 10.1.15

Type: Bug Priority: Major
Reporter: Pavel Ivanov Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 1
Labels: None


 Description   

Current implementation of Item_cache::is_null() in MariaDB comes from http://bazaar.launchpad.net/~maria-captains/maria/10.0/revision/2502.313.1 which was fixing incorrect query results. MySQL 5.6 apparently had similar problems with incorrect query results, but they fixed Item_cache::is_null() slightly differently: http://bazaar.launchpad.net/~mysql/mysql-server/5.6/revision/3690.1.115. And it turns out that MySQL's implementation is correct while MariaDB's is not.

Unfortunately I don't know if it's possible to exhibit the problem using some SQL – the test from MySQL's patch passes on MariaDB. But the difference for us was in the custom storage engine inside the cond_push() function. Apparently by the time this function is called Item_cache doesn't have a cached value yet and thus is_null() always return true leading to incorrect behavior of the storage engine.

Please incorporate MySQL's implementation of Item_cache::is_null() and if possible add a test for this specific problem.



 Comments   
Comment by Daniel Black [ 2015-07-19 ]

seems to still be the case https://github.com/MariaDB/server/blob/10.0/sql/item.h#L4560

Comment by Lena Startseva [ 2022-01-25 ]

Resolved: https://github.com/MariaDB/server/blob/10.2/sql/item.h#L5831

Comment by Lena Startseva [ 2022-01-25 ]

Fixed in commit 56a34960678874fad2ec99cc94c37f4e82dfccaa

Generated at Thu Feb 08 07:15:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.