Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OR clause on FLOAT/DOUBLE column unexpectedly evaluates to TRUE #15987

Closed
mrigger opened this issue Apr 1, 2020 · 1 comment · Fixed by #16542
Closed

OR clause on FLOAT/DOUBLE column unexpectedly evaluates to TRUE #15987

mrigger opened this issue Apr 1, 2020 · 1 comment · Fixed by #16542
Assignees
Labels

Comments

@mrigger
Copy link

mrigger commented Apr 1, 2020

Consider the following statements:

CREATE TABLE t0(c0 FLOAT);
INSERT INTO t0(c0) VALUES (NULL);
SELECT * FROM t0 WHERE NOT(0 OR t0.c0); -- expected: {}, actual: {NULL}

Unexpectedly, the SELECT fetches a row. Since the predicate should evaluate to NULL, I would expect that no rows are fetched. When, for example, changing the type of c0 to INT, the query works as expected.

Environment:

mysql> select tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                          |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.0-beta.2-160-g82529c886
Git Commit Hash: 82529c886cb1cfff7810476a136acf81284bac6e
Git Branch: master
UTC Build Time: 2020-04-01 11:44:27
GoVersion: go1.13.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@mrigger mrigger added the type/bug The issue is confirmed as a bug. label Apr 1, 2020
@Reminiscent Reminiscent assigned Reminiscent and unassigned wshwsh12 Apr 2, 2020
@Reminiscent
Copy link
Contributor

Same with #15718 . This is because the keepNull variable in the isTrue expression signature was not pushed down. This can be fixed by #15926 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants