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

table schema is different for execute and select for update in transaction #34289

Closed
lcwangchao opened this issue Apr 27, 2022 · 2 comments
Closed
Labels
severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(id int primary key, v int);
insert into t values(1, 1);
prepare s from 'select * from t where id=1 for update';
begin;
             alter table t add column v2 int; -- in another session
select * from t where id=1 for update;
execute s;

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

The result schema should be the same.

mysql> execute s;
+----+------+
| id | v    |
+----+------+
|  1 |    1 |
+----+------+
1 row in set (0.00 sec)

mysql> select * from t where id=1 for update;
+----+------+
| id | v    |
+----+------+
|  1 |    1 |
+----+------+

3. What did you see instead (Required)

mysql> execute s;
+----+------+------+
| id | v    | v2   |
+----+------+------+
|  1 |    1 | NULL |
+----+------+------+
1 row in set (0.00 sec)

mysql> select * from t where id=1 for update;
+----+------+
| id | v    |
+----+------+
|  1 |    1 |
+----+------+

4. What is your TiDB version? (Required)

master

@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. sig/transaction SIG:Transaction severity/moderate labels Apr 27, 2022
@lcwangchao
Copy link
Collaborator Author

#22381 and #26759 forces the execute statement in execute using the latest infoschema to avoid some problems in plancache. But it also caused the problem in this issue.

@lcwangchao
Copy link
Collaborator Author

dup with #34974

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

No branches or pull requests

1 participant