-
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
Improved Compatibility Around LAST_INSERT_ID #17369
Closed
Closed
Conversation
This file contains 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
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
|
vitess-bot
bot
added
NeedsBackportReason
If backport labels have been applied to a PR, a justification is required
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsIssue
A linked issue is missing for this Pull Request
NeedsWebsiteDocsUpdate
What it says
labels
Dec 11, 2024
systay
added
Type: Bug
Component: Query Serving
and removed
NeedsDescriptionUpdate
The description is not clear or comprehensive enough, and needs work
NeedsWebsiteDocsUpdate
What it says
NeedsIssue
A linked issue is missing for this Pull Request
NeedsBackportReason
If backport labels have been applied to a PR, a justification is required
labels
Dec 11, 2024
systay
changed the title
proto: add fetch_last_insert_id to ExecuteOptions
Bugfix: Handle last_insert_id(x) even when x is 0
Dec 11, 2024
systay
changed the title
Bugfix: Handle last_insert_id(x) even when x is 0
Bugfix: In DMLs, handle last_insert_id(x) even when x is 0
Dec 11, 2024
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17369 +/- ##
==========================================
- Coverage 67.52% 67.52% -0.01%
==========================================
Files 1581 1581
Lines 253948 254025 +77
==========================================
+ Hits 171480 171519 +39
- Misses 82468 82506 +38 ☔ View full report in Codecov by Sentry. |
systay
changed the title
Bugfix: In DMLs, handle last_insert_id(x) even when x is 0
Bugfix: handle last_insert_id(x) even when x is 0
Dec 16, 2024
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]>
systay
force-pushed
the
dml-last-insert-id
branch
from
December 17, 2024 07:36
0973a29
to
fbc3dbb
Compare
5 tasks
systay
force-pushed
the
dml-last-insert-id
branch
from
December 17, 2024 09:17
8529995
to
fbc3dbb
Compare
… modified Signed-off-by: Harshit Gangal <[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]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
systay
requested review from
deepthi,
harshit-gangal,
mattlord,
shlomi-noach,
rohit-nayak-ps,
timvaillancourt,
frouioui,
GuptaManan100,
arthurschreiber and
vmg
as code owners
December 18, 2024 12:04
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
systay
changed the title
Bugfix: handle last_insert_id(x) even when x is 0
Improved Compatibility Around LAST_INSERT_ID
Dec 18, 2024
systay
added
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
and removed
Type: Bug
labels
Dec 18, 2024
Signed-off-by: Andres Taylor <[email protected]>
systay
force-pushed
the
dml-last-insert-id
branch
from
December 18, 2024 17:17
02821a8
to
a1c2707
Compare
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Component: Query Serving
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
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 improves last_insert_id(x) behavior to align more closely with MySQL in various scenarios.
Key changes
fetch_last_insert_id
FieldIntroduced a boolean field, fetch_last_insert_id, in the ExecuteOptions proto.
SELECT last_insert_id()
query immediately after executing a query containing alast_insert_id(x)
expression.sqltypes.Result
UpdatesInsertIDChanged
.0
LIMIT
Behavior:LIMIT
to ensure all input rows are received when expectinglast_insert_id
values.Known Shortcomings:
For queries such as:
If the results are fetched from multiple shards, the
last_insert_id()
session state may not match the value of the last row returned from the query.last_insert_id
based on the final row of the query.Related Issue(s)
Fixes #17298
Checklist