Skip to content

Commit

Permalink
sql: add nil guard when formatting placeholders
Browse files Browse the repository at this point in the history
Release note (bug fix): Fixed a crash that could happen when formatting
queries that have placeholder BitArray arguments.

Release note: Fix a panic.
  • Loading branch information
rafiss committed Aug 22, 2022
1 parent 9c92d55 commit cfc445a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/conn_executor_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ func formatWithPlaceholders(ast tree.Statement, evalCtx *eval.Context) string {
fmtFlags,
tree.FmtPlaceholderFormat(func(ctx *tree.FmtCtx, placeholder *tree.Placeholder) {
d, err := eval.Expr(evalCtx, placeholder)
if err != nil {
if err != nil || d == nil {
// Fall back to the default behavior if something goes wrong.
ctx.Printf("$%d", placeholder.Idx+1)
return
Expand Down

0 comments on commit cfc445a

Please sign in to comment.