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

apply return wrong result in transaction #19435

Closed
ChenPeng2013 opened this issue Aug 25, 2020 · 1 comment · Fixed by #19447
Closed

apply return wrong result in transaction #19435

ChenPeng2013 opened this issue Aug 25, 2020 · 1 comment · Fixed by #19447
Assignees
Labels

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t, t1;
create table t1(c_int int);
create table t(c_int int);
insert into t values(1),(2),(3),(4),(5),(6),(7),(8),(9);
begin;
insert into t1 values(18);
select (select min(t1.c_int) from t1 where t1.c_int > t.c_int), (select max(t1.c_int) from t1 where t1.c_int> t.c_int), (select sum(t1.c_int) from t1 where t1.c_int> t.c_int) from t;
rollback;

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

mysql> select (select min(t1.c_int) from t1 where t1.c_int > t.c_int), (select max(t1.c_int) from t1 where t1.c_int> t.c_int), (select sum(t1.c_int) from t1 where t1.c_int> t.c_int) from t;
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
| (select min(t1.c_int) from t1 where t1.c_int > t.c_int) | (select max(t1.c_int) from t1 where t1.c_int> t.c_int) | (select sum(t1.c_int) from t1 where t1.c_int> t.c_int) |
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     18 |
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
9 rows in set (0.00 sec)

3. What did you see instead (Required)


mysql> select (select min(t1.c_int) from t1 where t1.c_int > t.c_int), (select max(t1.c_int) from t1 where t1.c_int> t.c_int), (select sum(t1.c_int) from t1 where t1.c_int> t.c_int) from t;
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
| (select min(t1.c_int) from t1 where t1.c_int > t.c_int) | (select max(t1.c_int) from t1 where t1.c_int> t.c_int) | (select sum(t1.c_int) from t1 where t1.c_int> t.c_int) |
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
|                                                      18 |                                                     18 |                                                     18 |
|                                                      18 |                                                     18 |                                                     36 |
|                                                      18 |                                                     18 |                                                     54 |
|                                                      18 |                                                     18 |                                                     72 |
|                                                      18 |                                                     18 |                                                     90 |
|                                                      18 |                                                     18 |                                                    108 |
|                                                      18 |                                                     18 |                                                    126 |
|                                                      18 |                                                     18 |                                                    144 |
|                                                      18 |                                                     18 |                                                    162 |
+---------------------------------------------------------+--------------------------------------------------------+--------------------------------------------------------+
9 rows in set (0.01 sec)

4. What is your TiDB version? (Required)

master & release-4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants