Skip to content

Bug Report: Unexpected result when using LIKE operator #16831

Description

@suyZhong

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_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions