Skip to content

Unexpected Results when Using '%' operator #7006

Description

@suyZhong

Considering the test case below:

CREATE TABLE t0(c1 INT);
INSERT INTO t0(c1) VALUES (1);

SELECT * FROM t0;
SELECT (c1 NOT IN (1%true)) IS NULL FROM t0;  -- 1
SELECT * FROM t0 WHERE (c1 NOT IN (1%true)) IS NULL; 
-- Expected: 1
-- Actual: empty

The third SELECT returns an empty result, which is surprising: If the result of second query is 1 (TRUE), the value of the NOT IN expression should be true, and thus the third query should return the row in t0.

This test case works well in MySQL 8.0.33, however not works in dolt 1.26.1

Besides, I also find a discrepancy between dolt and MySQL for this query:

SELECT 1 % true;
-- MySQL: 0
-- dolt: NULL

I originally find this when using the latest docker image dolt-sql-server 1.26.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions