Skip to content

Fix usage of last_insert_id with updates#3108

Merged
sougou merged 1 commit intovitessio:masterfrom
HubSpot:last_insert_seq
Aug 25, 2017
Merged

Fix usage of last_insert_id with updates#3108
sougou merged 1 commit intovitessio:masterfrom
HubSpot:last_insert_seq

Conversation

@bbeaudreault
Copy link
Contributor

@sougou we have a use case that uses a table as a sequence generator. This should work per https://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_last-insert-id.

When the app is run against direct mysql it would return the sequence value generated. But against vitess it would always return 0. This is because we were not filling in the InsertId in execDMLPK.

I added a test case and added the 1 line fix. Let me know if you can think of any other tests or issues

@sougou
Copy link
Contributor

sougou commented Aug 25, 2017

LGTM

Approved with PullApprove

@sougou sougou merged commit 4e327b5 into vitessio:master Aug 25, 2017
@bbeaudreault
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants