Message: select `test`.`t1`.`c1` AS `c1`,(`test`.`t1`.`c1` is not null) AS `c1 i
s not null`,(((`test`.`t1`.`c1` is not null) >= (not(1))) is not null) AS `a` fr
om `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is n
ot null)
1 row in set (0.00 sec)
MariaDB [test]> select 1 is not null;
+---------------+
| 1 is not null |
+---------------+
| 1 |
+---------------+
1 row in set (0.00 sec)
So, it seems expression is evaluated differently somehow when it's in WHERE clause comparing to it's value in SELECT clause.
Valerii Kravchuk
added a comment - I can reproduce this with 10.1.13 also:
C:\Program Files (x86)\MariaDB 10.1\bin>mysql -uroot -proot -P3316 test
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.13-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [test]> drop table t1;
Query OK, 0 rows affected (0.47 sec)
MariaDB [test]> create table t1(c1 int);
Query OK, 0 rows affected (0.19 sec)
MariaDB [test]> insert into t1 values(1);
Query OK, 1 row affected (0.14 sec)
MariaDB [test]> select * from t1 where ( (c1 is not null) >= (not true) ) is not
null;
Empty set (0.08 sec)
MariaDB [test]> select c1, c1 is not null, not true, ((c1 is not null) >= (not true)) as a from t1;
+------+----------------+----------+---+
| c1 | c1 is not null | not true | a |
+------+----------------+----------+---+
| 1 | 1 | 0 | 1 |
+------+----------------+----------+---+
1 row in set (0.00 sec)
MariaDB [test]> select c1, c1 is not null, not true, ((c1 is not null) >= (not true)) is not null as a from t1;
+------+----------------+----------+---+
| c1 | c1 is not null | not true | a |
+------+----------------+----------+---+
| 1 | 1 | 0 | 1 |
+------+----------------+----------+---+
1 row in set (0.00 sec)
MariaDB [test]> select c1, c1 is not null, (((c1 is not null) >= (not true)) is
not null) as a from t1 where ( (c1 is not null) >= (not true) ) is not null;
Empty set (0.00 sec)
MariaDB [test]> explain extended select c1, c1 is not null, (((c1 is not null) >
= (not true)) is not null) as a from t1 where ( (c1 is not null) >= (not true) )
is not null;
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | ro
ws | filtered | Extra |
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL |
1 | 100.00 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
1 row in set, 1 warning (0.06 sec)
MariaDB [test]> show warnings\G
*************************** 1. row ***************************
Level: Note
Code: 1003
Message: select `test`.`t1`.`c1` AS `c1`,(`test`.`t1`.`c1` is not null) AS `c1 i
s not null`,(((`test`.`t1`.`c1` is not null) >= (not(1))) is not null) AS `a` fr
om `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is n
ot null)
1 row in set (0.00 sec)
MariaDB [test]> select 1 is not null;
+---------------+
| 1 is not null |
+---------------+
| 1 |
+---------------+
1 row in set (0.00 sec)
So, it seems expression is evaluated differently somehow when it's in WHERE clause comparing to it's value in SELECT clause.
With Oracle's MySQL 5.6.23 we have correct result:
C:\Program Files (x86)\MariaDB 10.1\bin>mysql -uroot -proot -P3314 test
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [test]> drop table t1;
Query OK, 0 rows affected (0.22 sec)
MySQL [test]> create table t1(c1 int);
Query OK, 0 rows affected (0.03 sec)
MySQL [test]> insert into t1 values(1);
Query OK, 1 row affected (0.03 sec)
MySQL [test]> select * from t1 where ( (c1 is not null) >= (not true) ) is not null;
+------+
| c1 |
+------+
| 1 |
+------+
Valerii Kravchuk
added a comment - With Oracle's MySQL 5.6.23 we have correct result:
C:\Program Files (x86)\MariaDB 10.1\bin>mysql -uroot -proot -P3314 test
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [test]> drop table t1;
Query OK, 0 rows affected (0.22 sec)
MySQL [test]> create table t1(c1 int);
Query OK, 0 rows affected (0.03 sec)
MySQL [test]> insert into t1 values(1);
Query OK, 1 row affected (0.03 sec)
MySQL [test]> select * from t1 where ( (c1 is not null) >= (not true) ) is not null;
+------+
| c1 |
+------+
| 1 |
+------+
Importantly, in order to reproduce the problem, the table needs to be InnoDB (not MyISAM).
droptableif exists t1;
createtable t1(c1 int) engine=InnoDB;
insertinto t1 values(1);
select * from t1 where ( (c1 isnotnull) >= (nottrue) ) isnotnull;
bar, please take a look, maybe it falls into your area.
Please feel free to modify 'Fix version/s' field as you like.
Elena Stepanova
added a comment - Importantly, in order to reproduce the problem, the table needs to be InnoDB (not MyISAM).
drop table if exists t1;
create table t1(c1 int ) engine=InnoDB;
insert into t1 values (1);
select * from t1 where ( (c1 is not null ) >= ( not true ) ) is not null ;
bar , please take a look, maybe it falls into your area.
Please feel free to modify 'Fix version/s' field as you like.
The problem is also repeatable with MyISAM, with more than one records inserted:
droptableif exists t1;
CREATETABLE t1 (c1 INT) ENGINE=MyISAM;
INSERTINTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE ((c1 ISNOTNULL) >= (NOTTRUE)) ISNOTNULL;
returns empty set.
Alexander Barkov
added a comment - The problem is also repeatable with MyISAM, with more than one records inserted:
drop table if exists t1;
CREATE TABLE t1 (c1 INT ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE ((c1 IS NOT NULL ) >= ( NOT TRUE )) IS NOT NULL ;
returns empty set.
People
Alexander Barkov
Dylan Su
Votes:
1Vote for this issue
Watchers:
6Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":880.5999999046326,"ttfb":271.40000009536743,"pageVisibility":"visible","entityId":57074,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"112a668d-2c6b-470d-9412-65cfa18d8456","navigationType":0,"readyForUser":959.8000001907349,"redirectCount":0,"resourceLoadedEnd":1004.3000001907349,"resourceLoadedStart":279.40000009536743,"resourceTiming":[{"duration":23.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":279.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":279.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":302.5,"responseStart":0,"secureConnectionStart":0},{"duration":25.700000286102295,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":279.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":279.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":305.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":79.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":279.80000019073486,"connectEnd":279.80000019073486,"connectStart":279.80000019073486,"domainLookupEnd":279.80000019073486,"domainLookupStart":279.80000019073486,"fetchStart":279.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":279.80000019073486,"responseEnd":359.59999990463257,"responseStart":359.59999990463257,"secureConnectionStart":279.80000019073486},{"duration":157.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":280,"connectEnd":280,"connectStart":280,"domainLookupEnd":280,"domainLookupStart":280,"fetchStart":280,"redirectEnd":0,"redirectStart":0,"requestStart":280,"responseEnd":437.5,"responseStart":437.5,"secureConnectionStart":280},{"duration":161.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":280.19999980926514,"connectEnd":280.19999980926514,"connectStart":280.19999980926514,"domainLookupEnd":280.19999980926514,"domainLookupStart":280.19999980926514,"fetchStart":280.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":280.19999980926514,"responseEnd":441.5,"responseStart":441.5,"secureConnectionStart":280.19999980926514},{"duration":162.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":280.40000009536743,"connectEnd":280.40000009536743,"connectStart":280.40000009536743,"domainLookupEnd":280.40000009536743,"domainLookupStart":280.40000009536743,"fetchStart":280.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":280.40000009536743,"responseEnd":442.80000019073486,"responseStart":442.80000019073486,"secureConnectionStart":280.40000009536743},{"duration":162.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":280.59999990463257,"connectEnd":280.59999990463257,"connectStart":280.59999990463257,"domainLookupEnd":280.59999990463257,"domainLookupStart":280.59999990463257,"fetchStart":280.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":280.59999990463257,"responseEnd":443.19999980926514,"responseStart":443.19999980926514,"secureConnectionStart":280.59999990463257},{"duration":224,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":280.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":280.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":504.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":163.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":280.90000009536743,"connectEnd":280.90000009536743,"connectStart":280.90000009536743,"domainLookupEnd":280.90000009536743,"domainLookupStart":280.90000009536743,"fetchStart":280.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":280.90000009536743,"responseEnd":444.09999990463257,"responseStart":444.09999990463257,"secureConnectionStart":280.90000009536743},{"duration":224,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":281.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":163.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":281.30000019073486,"connectEnd":281.30000019073486,"connectStart":281.30000019073486,"domainLookupEnd":281.30000019073486,"domainLookupStart":281.30000019073486,"fetchStart":281.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":281.30000019073486,"responseEnd":445.19999980926514,"responseStart":445.19999980926514,"secureConnectionStart":281.30000019073486},{"duration":617.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":282.09999990463257,"connectEnd":282.09999990463257,"connectStart":282.09999990463257,"domainLookupEnd":282.09999990463257,"domainLookupStart":282.09999990463257,"fetchStart":282.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":282.09999990463257,"responseEnd":899.9000000953674,"responseStart":899.9000000953674,"secureConnectionStart":282.09999990463257},{"duration":618.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":282.19999980926514,"connectEnd":282.19999980926514,"connectStart":282.19999980926514,"domainLookupEnd":282.19999980926514,"domainLookupStart":282.19999980926514,"fetchStart":282.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":282.19999980926514,"responseEnd":900.8000001907349,"responseStart":900.8000001907349,"secureConnectionStart":282.19999980926514},{"duration":149.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":517.0999999046326,"connectEnd":517.0999999046326,"connectStart":517.0999999046326,"domainLookupEnd":517.0999999046326,"domainLookupStart":517.0999999046326,"fetchStart":517.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":517.0999999046326,"responseEnd":666.6999998092651,"responseStart":666.6999998092651,"secureConnectionStart":517.0999999046326},{"duration":210.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":778.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":778.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":988.5,"responseStart":0,"secureConnectionStart":0},{"duration":217.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":779.3000001907349,"connectEnd":779.3000001907349,"connectStart":779.3000001907349,"domainLookupEnd":779.3000001907349,"domainLookupStart":779.3000001907349,"fetchStart":779.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":779.3000001907349,"responseEnd":996.9000000953674,"responseStart":996.9000000953674,"secureConnectionStart":779.3000001907349},{"duration":224.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":779.6999998092651,"connectEnd":779.6999998092651,"connectStart":779.6999998092651,"domainLookupEnd":779.6999998092651,"domainLookupStart":779.6999998092651,"fetchStart":779.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":779.6999998092651,"responseEnd":1004.3000001907349,"responseStart":1004.3000001907349,"secureConnectionStart":779.6999998092651},{"duration":240.7000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":873.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":873.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1114.4000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":110,"responseStart":271,"responseEnd":277,"domLoading":275,"domInteractive":1044,"domContentLoadedEventStart":1044,"domContentLoadedEventEnd":1107,"domComplete":1439,"loadEventStart":1439,"loadEventEnd":1439,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1007.0999999046326},{"name":"bigPipe.sidebar-id.end","time":1008},{"name":"bigPipe.activity-panel-pipe-id.start","time":1008.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1012.3000001907349},{"name":"activityTabFullyLoaded","time":1130.8000001907349}],"measures":[],"correlationId":"81cae79cb3046e","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":98,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I can reproduce this with 10.1.13 also:
C:\Program Files (x86)\MariaDB 10.1\bin>mysql -uroot -proot -P3316 test
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.13-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [test]> drop table t1;
Query OK, 0 rows affected (0.47 sec)
MariaDB [test]> create table t1(c1 int);
Query OK, 0 rows affected (0.19 sec)
MariaDB [test]> insert into t1 values(1);
Query OK, 1 row affected (0.14 sec)
MariaDB [test]> select * from t1 where ( (c1 is not null) >= (not true) ) is not
null;
Empty set (0.08 sec)
MariaDB [test]> select c1, c1 is not null, not true, ((c1 is not null) >= (not true)) as a from t1;
+------+----------------+----------+---+
| c1 | c1 is not null | not true | a |
+------+----------------+----------+---+
| 1 | 1 | 0 | 1 |
+------+----------------+----------+---+
1 row in set (0.00 sec)
MariaDB [test]> select c1, c1 is not null, not true, ((c1 is not null) >= (not true)) is not null as a from t1;
+------+----------------+----------+---+
| c1 | c1 is not null | not true | a |
+------+----------------+----------+---+
| 1 | 1 | 0 | 1 |
+------+----------------+----------+---+
1 row in set (0.00 sec)
MariaDB [test]> select c1, c1 is not null, (((c1 is not null) >= (not true)) is
not null) as a from t1 where ( (c1 is not null) >= (not true) ) is not null;
Empty set (0.00 sec)
MariaDB [test]> explain extended select c1, c1 is not null, (((c1 is not null) >
= (not true)) is not null) as a from t1 where ( (c1 is not null) >= (not true) )
is not null;
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | ro
ws | filtered | Extra |
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
| 1 | SIMPLE | t1 | ALL | NULL | NULL | NULL | NULL |
1 | 100.00 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+---
---+----------+-------------+
1 row in set, 1 warning (0.06 sec)
MariaDB [test]> show warnings\G
*************************** 1. row ***************************
Level: Note
Code: 1003
Message: select `test`.`t1`.`c1` AS `c1`,(`test`.`t1`.`c1` is not null) AS `c1 i
s not null`,(((`test`.`t1`.`c1` is not null) >= (not(1))) is not null) AS `a` fr
om `test`.`t1` where (((`test`.`t1`.`c1` is not null) >= <cache>((not(1)))) is n
ot null)
1 row in set (0.00 sec)
MariaDB [test]> select 1 is not null;
+---------------+
| 1 is not null |
+---------------+
| 1 |
+---------------+
1 row in set (0.00 sec)
So, it seems expression is evaluated differently somehow when it's in WHERE clause comparing to it's value in SELECT clause.