Skip to content

Commit

Permalink
Merge pull request #56784 from RaduBerinde/backport20.2-56768
Browse files Browse the repository at this point in the history
release-20.2: sql: fix panic when getting support bundle
  • Loading branch information
RaduBerinde authored Nov 17, 2020
2 parents 9a2605d + b013a62 commit 4aabe96
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/sql/explain_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,16 @@ func (b *stmtBundleBuilder) addStatement() {
cfg.Simplify = true
cfg.Align = tree.PrettyNoAlign
cfg.JSONFmt = true
output := cfg.Pretty(b.plan.stmt.AST)
var output string
// If we hit an early error, stmt or stmt.AST might not be initialized yet.
switch {
case b.plan.stmt == nil:
output = "No Statement."
case b.plan.stmt.AST == nil:
output = "No AST."
default:
output = cfg.Pretty(b.plan.stmt.AST)
}

if b.placeholders != nil && len(b.placeholders.Values) != 0 {
var buf bytes.Buffer
Expand Down

0 comments on commit 4aabe96

Please sign in to comment.