stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
857 stars 140 forks source link

bug: after altering operation, `NULL` values is evlauated to be `TRUE` in StoneDB #1945

Open ZhengLin-Li opened 11 months ago

ZhengLin-Li commented 11 months ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

SQLancer found that, after altering operation, NULL values is evlauated to be TRUE in StoneDB.

However, accroding to link: In MySQL, 0 or NULL means false and anything else means true. The default truth value from a boolean operation is 1.

Result in StoneDB:

image

Result in MySQL 5.7:

image

Expected behavior

No response

How To Reproduce

CREATE TABLE t0(c0 DATE);
INSERT INTO t0(c0) VALUES (DATE '1970-01-04'), (DEFAULT);
ALTER TABLE t0 CHANGE c0 c0 TEXT ;
SELECT * FROM t0 WHERE t0.c0 IS TRUE;
SELECT t0.c0 IS TRUE FROM t0;

Environment

Docker image v:1.0.4

Are you interested in submitting a PR to solve the problem?