-
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 recently introduced minor bug around PREPARE #108461
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
@@ -903,6 +903,9 @@ func (ex *connExecutor) execStmtInOpenState( | |||
// PREPARE statement itself. | |||
oldPlaceholders := p.extendedEvalCtx.Placeholders | |||
p.extendedEvalCtx.Placeholders = nil | |||
defer func() { | |||
p.extendedEvalCtx.Placeholders = oldPlaceholders |
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.
ty for fixing this! i think we could also put this into the defer:
// The call to addPreparedStmt changed the planner stmt to the statement
// being prepared. Set it back to the PREPARE statement, so that it's
// logged correctly.
p.stmt = stmt
In just merged 4a3e787, we had a minor bug that in case `addPreparedStmt` call fails, we don't restore the original placeholders, which can then lead to panics. Release note: None
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.
TFTR!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/conn_executor_exec.go
line 907 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
ty for fixing this! i think we could also put this into the defer:
// The call to addPreparedStmt changed the planner stmt to the statement // being prepared. Set it back to the PREPARE statement, so that it's // logged correctly. p.stmt = stmt
Done.
Build failed (retrying...): |
Build succeeded: |
In just merged 4a3e787, we had a minor bug that in case
addPreparedStmt
call fails, we don't restore the original placeholders, which can then lead to panics.Fixes: #108421.
Release note: None