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

DELETE doesn't delete data in some cases when the database name is capitalized #21200

Closed
winoros opened this issue Nov 23, 2020 · 1 comment · Fixed by #21202
Closed

DELETE doesn't delete data in some cases when the database name is capitalized #21200

winoros opened this issue Nov 23, 2020 · 1 comment · Fixed by #21202
Assignees
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Milestone

Comments

@winoros
Copy link
Member

winoros commented Nov 23, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop database if exists test1;
create database TEST1;
use TEST1;
create table t(a int);
create table t1(a int);
insert into t values(1);
insert into t1 values(1);

delete a from t a where exists (select 1 from t1 where a.a = t1.a);

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

The row in t is deleted successfully.

3. What did you see instead (Required)

No row is deleted.

4. What is your TiDB version? (Required)

Latest master and 4.0.8.

@ti-srebot
Copy link
Contributor

ti-srebot commented Nov 23, 2020

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

The code treats a string which can have upper case char as a string only has lower case char. This behavior leads to unexpected DELETE behavior.

2. Symptom (optional)

The rows should be deleted aren't deleted.

3. All Trigger Conditions (optional)

use USE stetament choose a database whose original name in its CREATE DATABASE statement is not in pure lower representation.

Then deleting the tables in this database may not delete any data.

4. Workaround (optional)

5. Affected versions

[v3.0.1:v3.0.19], [v4.0.1:v4.0.8]

6. Fixed versions

v3.0.20, v4.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants