-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: fix UPSERT RETURNING in presence of schema changes #29487
Conversation
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.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/sql/descriptor_mutation_test.go, line 191 at r2 (raw file):
mTest.Exec(t, `UPSERT INTO t.test VALUES('a', 'bar')`) mTest.Exec(t, `UPSERT INTO t.test VALUES('foo') RETURNING k`)
Looks like you only need this statement in this test; right?
Also, could you add an INSERT statement as well. Thanks!
pkg/sql/tablewriter_upsert.go, line 43 at r2 (raw file):
// rowIdxToRetIdx maps the indices in the inserted rows // back to indices in rowTemplate. Contains -1 for indices in the inserted // rows that shouldn't be returned to the user - mutation columns.
how about creating
const dontReturnCol = -1
It will make this code more readable
Thanks, will do. Also, this fix isn't complete, there's another bug lurking... will send another patch. |
25e56d8
to
bd67b49
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/sql/descriptor_mutation_test.go, line 191 at r2 (raw file):
Previously, vivekmenezes wrote…
Looks like you only need this statement in this test; right?
Also, could you add an INSERT statement as well. Thanks!
Done.
pkg/sql/tablewriter_upsert.go, line 43 at r2 (raw file):
Previously, vivekmenezes wrote…
how about creating
const dontReturnCol = -1
It will make this code more readable
Done.
bd67b49
to
0d4f135
Compare
Release note (bug fix): fix crash caused by certain kinds of UPSERT RETURNING statements on tables with active schema changes.
0d4f135
to
e9f0f9b
Compare
bors r+ |
29487: sql: fix UPSERT RETURNING in presence of schema changes r=jordanlewis a=jordanlewis Fixes #29436. Release note (bug fix): fix crash caused by certain kinds of UPSERT RETURNING statements on tables with active schema changes. Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
Build succeeded |
Fixes #29436.
Release note (bug fix): fix crash caused by certain kinds of UPSERT
RETURNING statements on tables with active schema changes.