vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.67k stars 2.1k forks source link

Bug Report: Unexpected result when using `LIKE` operator #16831

Closed suyZhong closed 1 month ago

suyZhong commented 1 month ago

Overview of the Issue

Consider the following test case. The first query is evaluated to 0. However, its negation is also evaluated to 0. Thus at least one query returns an unexpected result. Besides, it's different from MySQL.

Reproduction Steps

Start the Vittestserver docker container according to https://vitess.io/docs/21.0/get-started/vttestserver-docker-image/#example

Execute the following SQL using a MySQL client

SELECT (1 LIKE('a' IS NULL)); -- 0
SELECT (NOT (1 LIKE('a' IS NULL))); -- 0  (Unexpected)

-- MySQL:
SELECT (1 LIKE('a' IS NULL)); -- 0
SELECT (NOT (1 LIKE('a' IS NULL))); -- 1

Binary Version

Version: 21.0.0-SNAPSHOT (Git revision e0a5069cd378269d5a88c3c48cd699a45ee8ab67 branch 'main')

Operating System and Environment details

docker pull vitess/vttestserver:mysql80
x86_64


### Log Fragments

_No response_
systay commented 1 month ago

I can confirm that this is failing on vitessio/vitess on main