Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalar function causes database crash. #57647

Open
yanghy233 opened this issue Nov 23, 2024 · 1 comment
Open

Scalar function causes database crash. #57647

yanghy233 opened this issue Nov 23, 2024 · 1 comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. type/bug The issue is confirmed as a bug.

Comments

@yanghy233
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. schema.
create table `t0`
(
    `vkey` integer,
    `pkey` integer,
    `c0`   integer
);

insert into `t0`
values (1, 2, 3);
  1. sql statement.
select *
from `t0`
where (nullif(
    3 ^ 10 & (abs(-50)) ,
    round(case when (((`t0`.`c0`) >= 1) or null) then 91 else 86 end)
    )) in (select `vkey` from `t0` where false);

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

MySQL and TIDB have different execution results in the above case.

The normal result in MySQL 8:

mysql> select *
    -> from `t0`
    -> where (nullif(
    ->     3 ^ 10 & (abs(-50)) ,
    ->     round(case when (((`t0`.`c0`) >= 1) or null) then 91 else 86 end)
    ->     )) in (select `vkey` from `t0` where false);
Empty set (0.00 sec)

TiDB should also return empty result, but failed.

3. What did you see instead (Required)

In TiDB v8.1.1:

MySQL [test]> select *
    -> from `t0`
    -> where (nullif(
    ->     3 ^ 10 & (abs(-50)) ,
    ->     round(case when (((`t0`.`c0`) >= 1) or null) then 91 else 86 end)
    ->     )) in (select `vkey` from `t0` where false);
ERROR 1105 (HY000): interface conversion: expression.Expression is *expression.ScalarFunction, not *expression.Column

TiDB crash when execute the same SQL statement.

4. What is your TiDB version? (Required)

tidb v8.1.1

@yanghy233 yanghy233 added the type/bug The issue is confirmed as a bug. label Nov 23, 2024
@yanghy233
Copy link
Author

/label affects-8.1

@ti-chi-bot ti-chi-bot bot added the affects-8.1 This bug affects the 8.1.x(LTS) versions. label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant