Support last_insert_id() with argument in SELECT#17295
Closed
systay wants to merge 11 commits intovitessio:mainfrom
Closed
Support last_insert_id() with argument in SELECT#17295systay wants to merge 11 commits intovitessio:mainfrom
last_insert_id() with argument in SELECT#17295systay wants to merge 11 commits intovitessio:mainfrom
Conversation
Contributor
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17295 +/- ##
==========================================
- Coverage 67.46% 67.45% -0.02%
==========================================
Files 1581 1583 +2
Lines 253934 254132 +198
==========================================
+ Hits 171329 171416 +87
- Misses 82605 82716 +111 ☔ View full report in Codecov by Sentry. |
last_insert_id() with argument
8871387 to
2792a28
Compare
2792a28 to
9bf59d8
Compare
9bf59d8 to
2792a28
Compare
6460bfc to
7be85da
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
…nsharded select queries Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
…e output Signed-off-by: Andres Taylor <andres@planetscale.com>
bb4b1e0 to
0ab3717
Compare
last_insert_id() with argumentlast_insert_id() with argument in SELECT
b251b81 to
ab151c8
Compare
Signed-off-by: Andres Taylor <andres@planetscale.com>
ab151c8 to
31af9e0
Compare
frouioui
reviewed
Dec 10, 2024
Comment on lines
+64
to
+66
| ### <a id="last_insert_id"/>Added support for LAST_INSERT_ID(expr) | ||
|
|
||
| Added support for LAST_INSERT_ID(expr) to align with MySQL behavior, enabling session-level assignment of the last insert ID via query expressions. |
Member
There was a problem hiding this comment.
It would be good to link to the PR and/or Issue so there is more context for those wanting to learn more.
Suggested change
| ### <a id="last_insert_id"/>Added support for LAST_INSERT_ID(expr) | |
| Added support for LAST_INSERT_ID(expr) to align with MySQL behavior, enabling session-level assignment of the last insert ID via query expressions. | |
| ### <a id="last_insert_id"/>Added support for LAST_INSERT_ID(expr) | |
| Added support for `LAST_INSERT_ID(expr)` to align with MySQL behavior, enabling session-level assignment of the last insert ID via query expressions. For more information about this change see [#17295](https://github.com/vitessio/vitess/pull/17295). |
frouioui
reviewed
Dec 10, 2024
| @@ -0,0 +1,125 @@ | |||
| /* | |||
| Copyright 2019 The Vitess Authors. | |||
Member
There was a problem hiding this comment.
Suggested change
| Copyright 2019 The Vitess Authors. | |
| Copyright 2024 The Vitess Authors. |
frouioui
approved these changes
Dec 10, 2024
Member
frouioui
left a comment
There was a problem hiding this comment.
just some minor comments, otherwise looks good to me, thank you! 🙇🏻
Collaborator
Author
|
Trying to get #17369 to cover all cases. Will close this for now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for
LAST_INSERT_ID(expr)in Vitess. The feature allows the argumentexprto be evaluated and stored as the session’s last insert ID, aligning with MySQL’s behavior. This extends Vitess’ compatibility for queries that rely on setting or retrieving session-level last insert ID values programmatically.However, unlike MySQL, this feature is limited to usage within SELECT expressions only (i.e., it cannot be used in WHERE, GROUP BY, HAVING, or other non-SELECT contexts), which introduces a remaining compatibility gap.
Related Issue(s)
Work towards fixing #6087
Checklist