Skip to content

Unexpected result #62269

@DerZc

Description

@DerZc

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

The following test case has two equivalent queries, one in normal format, and another one in prepared statement, but they return different result.

CREATE TABLE t0(c2 BOOL);
INSERT INTO t0(c2) VALUES (false), (true);
SELECT t0.c2 FROM t0 GROUP BY t0.c2 HAVING BIT_AND(BINARY (- (-1)));   -- 0, 1
SET @a = -1;
PREPARE prepare_query FROM 'SELECT t0.c2 FROM t0 GROUP BY t0.c2 HAVING BIT_AND(BINARY (- (?)))';
EXECUTE prepare_query USING @a;   -- empty result

2. What did you expect to see? (Required)

The prepared statement should also return 0 and 1, which is the result of this test case in MySQL

3. What did you see instead (Required)

The prepared statement returns empty result.

4. What is your TiDB version? (Required)

tidb_version()
Release Version: v7.5.1\nEdition: Community\nGit Commit Hash: 7d16cc79e81bbf573124df3fd9351c26963f3e70\nGit Branch: heads/refs/tags/v7.5.1\nUTC Build Time: 2024-02-27 14:28:32\nGoVersion: go1.21.6\nRace Enabled: false\nCheck Table Before Drop: false\nStore: unistore

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions