-
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
Support last_insert_id()
with argument in SELECT
#17295
Conversation
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 <[email protected]>
…nsharded select queries Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
…e output Signed-off-by: Andres Taylor <[email protected]>
bb4b1e0
to
0ab3717
Compare
last_insert_id()
with argumentlast_insert_id()
with argument in SELECT
b251b81
to
ab151c8
Compare
Signed-off-by: Andres Taylor <[email protected]>
ab151c8
to
31af9e0
Compare
### <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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to link to the PR and/or Issue so there is more context for those wanting to learn more.
### <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). |
@@ -0,0 +1,125 @@ | |||
/* | |||
Copyright 2019 The Vitess Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2019 The Vitess Authors. | |
Copyright 2024 The Vitess Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some minor comments, otherwise looks good to me, thank you! 🙇🏻
Trying to get #17369 to cover all cases. Will close this for now |
Description
This PR adds support for
LAST_INSERT_ID(expr)
in Vitess. The feature allows the argumentexpr
to 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