Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
128862: sql: revert multiple partial stats requests error to a pgerror r=Uzair5162 a=Uzair5162

This commit reverts a change in cockroachdb#127836 that changed the error returned when multiple stats are requested at once from a pgerror to a failed assertion. This change caused `GenerateAndCheckRedactedExplainsForPII()` to fail when generating SQL commands for certain explains on partial stats collections with multiple columns, which is unsupported and should be ignored like other pgerrors.

Fixes: cockroachdb#128848

Release note: None

Co-authored-by: Uzair Ahmad <[email protected]>
  • Loading branch information
craig[bot] and Uzair5162 committed Aug 13, 2024
2 parents e25886d + daf39c2 commit ed0cad0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sql/distsql_plan_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/stats"
"github.com/cockroachdb/cockroach/pkg/sql/stats/bounds"
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/logtags"
Expand Down Expand Up @@ -291,7 +292,10 @@ func (dsp *DistSQLPlanner) createPartialStatsPlan(
// Partial stats collections on multiple columns create different plans,
// so we only support one requested stat at a time here.
if len(reqStats) > 1 {
return nil, errors.AssertionFailedf("only one partial statistic can be requested at a time")
return nil, unimplemented.NewWithIssue(
128904,
"cannot process multiple partial statistics requests at once",
)
}

reqStat := reqStats[0]
Expand Down

0 comments on commit ed0cad0

Please sign in to comment.