-
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 not swap values by a multi-tables update #19137
Comments
/assign @zz-jason |
The MySQL behavior is explained in link, TiDB implementation is different from MySQL. |
MySQL behaviors are different for single and multiple tables, the TiDB behavior is more reasonable, I think we can document about this. |
I believe the SQL standards do talk about what the correct behavior is here. I am not sure if MySQL is necessarily correct, but if TiDB differs, it should be defendable if it is at least standard. |
I verify this in mysql version 8.0.19, it actually swaps two values from different tables. Should TiDB have the same behavior? @SunRunAway @cfzjywxk @nullnotnil
|
Yes, this is a standard behaviour in MySQL, but not only in MySQL, but most relational databases.responsed from Mysql comminuty |
I tried on SQLite3
|
PG
PG does not supprot update more than one tables in one statement:
|
compared Mysql to Oracle, PG and sqlLite, only mysql does not support swaping two columns. We can verify this on http://sqlfiddle.com/#!4/794de/1/0 |
I think it is better to have the standard behavior here. If it turns out users depend on the (incorrect) MySQL behavior, we can add an option to permit this behavior. But to keep the options to a minimum: change it first, add the option if it becomes required. |
Agree. Let's resolve this issue as @nullnotnil said. That is, TiDB swaps two values from one table if the query is cc @cfzjywxk, @lzmhhh123, @fzhedu |
/cc @dyzsr |
/assign |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
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 values of
t1.c_str
andt2.c_str
should be swapped in the above case, that is, the last selection should return an empty set.3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master @ 8978773
release-4.0 @ 3948c7b
The text was updated successfully, but these errors were encountered: