Skip to content

Commit

Permalink
Merge pull request #117631 from rytaft/backport23.1.14-rc-111347
Browse files Browse the repository at this point in the history
release-23.1.14-rc: sql: fix an exported gist out of bounds error (#117631)

Co-Authored-By: Tommy Reilly <[email protected]>
  • Loading branch information
rytaft and cucaroach authored Jan 11, 2024
2 parents ec0a638 + c17b263 commit 9a49e00
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 9a49e00

Please sign in to comment.