Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.31, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
-
Centos 7, cpanel
Description
I use a software called elevatedX. I recently ran a cpanel upgrade that upgraded MariaDB to 10.0.31. Since then the counting query in elevatedx runs but doesn't return any results. Prior to this everything was working find. ElevatedX has said its a bug in MariaDB. Here is what they told me. I apologize for lack of depth as I am not a dev.
This query works:
SELECT * FROM (totals) WHERE TotalDate IN (select MAX(TotalDate) from totals WHERE TotalDate <= '2017-05-26');
This, however, does not:
SELECT * FROM (totals) WHERE TotalDate IN (select MAX(TotalDate) from totals WHERE TotalDate <= '2017-05-26') OR TotalDate IS NULL;
This is a bug in your version of MariaDB. Please consult your host.
Any information on if this can be fixed or how I can downgrade would be appreciated.
Here's how to reproduce this on 10.0.31:
Table schema:
CREATE TABLE `test_bug_table` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`TotalDate` date DEFAULT NULL,
PRIMARY KEY (`Id`),
KEY `Opt1` (`TotalDate`)
) ENGINE=InnoDB AUTO_INCREMENT=1;
Populate data:
insert into test_bug_table (Id, TotalDate) VALUES (NULL, NOW()), (NULL, NOW()), (NULL, NOW()), (NULL, NOW()), (NULL, NOW());
Query that works:
SELECT * FROM (test_bug_table) WHERE
TotalDate IN (select MAX(TotalDate) from test_bug_table WHERE TotalDate <= NOW());
Query that does not work:
SELECT * FROM (test_bug_table) WHERE
TotalDate IN (select MAX(TotalDate) from test_bug_table WHERE TotalDate <= NOW()) OR TotalDate IS NULL;
The query above works on 10.0.30, but breaks on 10.0.31.
The issue here is that specifying "OR TotalDate IS NULL" should not exclude results from the subquery. This looks like a pretty big regression.