-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Can't find column in update statement and wrong update results #37568
Labels
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
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
affects-6.1
affects-6.2
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Comments
For the first update error, it seems there's something wrong in the logical plan builder:
|
ti-chi-bot
added
may-affects-4.0
This bug maybe affects 4.0.x versions.
may-affects-5.0
This bug maybe affects 5.0.x versions.
may-affects-5.1
This bug maybe affects 5.1.x versions.
may-affects-5.2
This bug maybe affects 5.2.x versions.
may-affects-5.3
This bug maybe affects 5.3.x versions.
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.0
may-affects-6.1
may-affects-6.2
may-affects-6.3
labels
Sep 2, 2022
jackysp
changed the title
Can't find column in update statement
Can't find column in update statement and wrong update results
Sep 2, 2022
Tried another update statement update tb1,(select tb2.balance ,user_no from tb2 order by seq_no desc limit 1 ) tb3 set tb1.balance=tb3.balance where tb1.user_no=tb3.user_no; get a panic,
But it doesn't appear in mocktikv, only with tikv cluster could meet this panic. |
jebter
added
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
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.1
labels
Sep 3, 2022
ti-chi-bot
removed
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-5.3
This bug maybe affects 5.3.x versions.
may-affects-5.1
This bug maybe affects 5.1.x versions.
may-affects-5.0
This bug maybe affects 5.0.x versions.
may-affects-5.2
This bug maybe affects 5.2.x versions.
labels
Sep 3, 2022
the reason is the same as: #10962, we should avoid projection elimination in buildUpdate.
|
12 tasks
AilinKid
added
affects-6.0
affects-6.2
and removed
may-affects-4.0
This bug maybe affects 4.0.x versions.
may-affects-6.0
may-affects-6.2
may-affects-6.3
labels
Sep 3, 2022
This was referenced Sep 4, 2022
AilinKid
added a commit
to AilinKid/tidb
that referenced
this issue
Sep 4, 2022
…esolution error. (pingcap#37582) close pingcap#37568
12 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
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
affects-6.1
affects-6.2
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The two update statements should be successful.
3. What did you see instead (Required)
The first one return an error, "ERROR 1105 (HY000): Can't find column test.tb2.balance in schema Column: [test.tb1.user_no,test.tb1.balance,test.tb2.balance] Unique key: []"
If I remove the first update statement, the second update statement will succeed, but it updates the wrong values.
The balance of user_no = 5 should be 2332.
If I run the second update statement again, I get
It seems the order by seq_no clause does not work.
I try the first statement in MySQL 8.0 it gets the correct results, and the second one returns an error, "ERROR 1221 (HY000): Incorrect usage of UPDATE and ORDER BY".
4. What is your TiDB version? (Required)
v6.1.0
The text was updated successfully, but these errors were encountered: