-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bug Report: result mismatch on LAST_INSERT_ID()
between Vitess and MySQL
#17298
Comments
The issue seems to be a bug in MySQL. Using a network sniffer we could see that MySQL is not sending back the |
Here is the packet output for different query which does not differ for when mysql> insert into t3 values (last_insert_id(0));
Query OK, 1 row affected (0.01 sec) mysql> insert into t3 values (7);
Query OK, 1 row affected (0.01 sec) with a mysql> insert into t3 values (last_insert_id(1));
Query OK, 1 row affected (0.01 sec) |
In Vitess, we only update the session state when From the above test, it is hard to determine when the session state be updated for A possible workaround for the application would be to use a different default than |
Yes, I would agree some change in the application, Would it possible to have some error? when last_insert_id(0) is executed given session state is updated only when last_insert_id is non-zero. |
I've opened a bug report for this: |
Overview of the Issue
In some cases using the
LAST_INSERT_ID()
function through Vitess (vtgate) yields a different result than running this against vanilla MySQL.Got a reproducible
vitess-tester
test caseTest case output:
Reproduction Steps
Error output
Vitess test-case files
dw_17047.test.txt
dw_17047.vschema.json
Binary Version
Operating System and Environment details
Log Fragments
No response
The text was updated successfully, but these errors were encountered: