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

Empty string has different meanings in SELECT and UPDATE in a transaction #27648

Open
TrocTool opened this issue Aug 28, 2021 · 2 comments · May be fixed by #27954
Open

Empty string has different meanings in SELECT and UPDATE in a transaction #27648

TrocTool opened this issue Aug 28, 2021 · 2 comments · May be fixed by #27954
Assignees
Labels
affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 severity/minor sig/planner SIG: Planner type/bug This issue is a bug.

Comments

@TrocTool
Copy link

TrocTool commented Aug 28, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

/* init */ drop table if exists t;
/* init */ create table t(a int, b int);
/* init */ insert into t values(1, 1), (2, 2), (3, 3);

/* s1 */ begin; -- 1
/* s1 */ update t set a = 10 where ' '; -- 2
/* s1 */ select * from t where ' '; -- 3
/* s1 */commit; -- 4
/* s1 */ select * from t; -- 5

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

statement 3 gets empty and statement5 gets
+------+------+
| a    | b    |
+------+------+
|   1  |    1 |
|   2  |    2 |
|   3  |    3 |
+------+------+


or

statement 3 gets
+------+------+
| a    | b    |
+------+------+
|   10 |    1 |
|   10 |    2 |
|   10 |    3 |
+------+------+

and statement 5 gets
+------+------+
| a    | b    |
+------+------+
|   10 |    1 |
|   10 |    2 |
|   10 |    3 |
+------+------+

3. What did you see instead (Required)

statement 3 gets empty but statement5 gets
+------+------+
| a    | b    |
+------+------+
|   10 |    1 |
|   10 |    2 |
|   10 |    3 |
+------+------+

4. What is your TiDB version? (Required)

v5.2.0

@TrocTool TrocTool added the type/bug This issue is a bug. label Aug 28, 2021
@aytrack aytrack added the sig/transaction SIG:Transaction label Sep 1, 2021
@zyguan zyguan added sig/planner SIG: Planner and removed sig/transaction SIG:Transaction labels Sep 3, 2021
@zyguan
Copy link
Contributor

zyguan commented Sep 3, 2021

Transaction is not required for this issue.

/* init */ drop table if exists t;
/* init */ create table t(a int, b int);
/* init */ insert into t values(1, 1), (2, 2), (3, 3);

/* s1 */ update t set a = 10 where ' ';
/* s1 */ select * from t where ' ';

TableFullScan gets used (instead of TableDual) when executing update t set a = 10 where ' ';.

@yuqi1129
Copy link
Contributor

/assign

@jebter jebter added affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. labels Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 severity/minor sig/planner SIG: Planner type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants