Skip to content

Commit

Permalink
sql: fix an exported gist out of bounds error
Browse files Browse the repository at this point in the history
Fixes: #111346
Release note: None
Epic: None
  • Loading branch information
cucaroach authored and rytaft committed Jan 10, 2024
1 parent ec0a638 commit c17b263
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/sql/opt/exec/explain/result_columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ func groupByColumns(
columns := make(colinfo.ResultColumns, 0, len(groupCols)+len(aggregations))
if inputCols != nil {
for _, col := range groupCols {
columns = append(columns, inputCols[col])
if len(inputCols) > int(col) {
columns = append(columns, inputCols[col])
}
}
}
for _, agg := range aggregations {
Expand Down
30 changes: 30 additions & 0 deletions pkg/sql/opt/exec/explain/testdata/gists
Original file line number Diff line number Diff line change
Expand Up @@ -1122,3 +1122,33 @@ explain(shape):
syntax: "select 123"
explain(gist):
• show completions

# Regression for #111346
explain-plan-gist
AgFWBgCPAQIAABNWCgsGBwwHHA0UAXoCBgEFUCJ6AQ==
----
• upsert
│ into: ?()
│ auto commit
└── • lookup join (left outer)
│ table: ?@?
│ equality: (_, _, _) = (?,?,?)
│ equality cols are key
└── • distinct
│ distinct on
└── • render
└── • render
└── • group (hash)
│ group by: _, _, _
└── • index join
│ table: ?@?
└── • scan
table: ?@?
spans: 1 span

0 comments on commit c17b263

Please sign in to comment.