Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: v20.1.5: unknown type when parsing string as an array element #59024

Closed
cockroach-teamcity opened this issue Jan 14, 2021 · 3 comments
Closed
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.

Comments

@cockroach-teamcity
Copy link
Member

This issue was autofiled by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.

Sentry link: https://sentry.io/organizations/cockroach-labs/issues/2153767188/?referrer=webhooks_plugin

Panic message:

*errors.errorString
*safedetails.withSafeDetails: unknown type %s (%T) (1)
parse_string.go:71: *withstack.withStack (2)
*assert.withAssertionFailure
*errutil.withMessage
*safedetails.withSafeDetails: could not parse %q as type %s (3)
datum.go:252: *withstack.withStack (4)
*pgerror.withCandidateCode: 22P02 (5)
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

default:
return nil, errors.AssertionFailedf("unknown type %s (%T)", t, t)
}
in pkg/sql/sem/tree.ParseAndRequireString
d, err := ParseAndRequireString(p.t, next, p.ctx)
if err != nil {
in pkg/sql/sem/tree.(*parseState).parseElement
if parser.peek() != '}' {
if err := parser.parseElement(); err != nil {
return nil, err
in pkg/sql/sem/tree.doParseDArrayFromString
func ParseDArrayFromString(ctx ParseTimeContext, s string, t *types.T) (*DArray, error) {
ret, err := doParseDArrayFromString(ctx, s, t)
if err != nil {
in pkg/sql/sem/tree.ParseDArrayFromString
case types.ArrayFamily:
return ParseDArrayFromString(ctx, s, t.ArrayContents())
case types.BitFamily:
in pkg/sql/sem/tree.ParseAndRequireString
datum, err := ParseAndRequireString(typ, expr.s, ctx)
return datum, err
in pkg/sql/sem/tree.(*StrVal).ResolveAsType
if desired.Equivalent(typ) {
return c.ResolveAsType(ctx, desired)
}
in pkg/sql/sem/tree.typeCheckConstant
func (expr *StrVal) TypeCheck(ctx *SemaContext, desired *types.T) (TypedExpr, error) {
return typeCheckConstant(expr, ctx, desired)
}
in pkg/sql/sem/tree.(*StrVal).TypeCheck
subExpr, err := expr.Expr.TypeCheck(ctx, types.MakeArray(desired))
if err != nil {
in pkg/sql/sem/tree.(*IndirectionExpr).TypeCheck
}
return expr.TypeCheck(ctx, desired)
}
in pkg/sql/sem/tree.TypeCheck
expr = s.walkExprTree(expr)
texpr, err := tree.TypeCheck(expr, s.builder.semaCtx, desired)
if err != nil {
in pkg/sql/opt/optbuilder.(*scope).resolveType
texpr = inScope.resolveType(e.Expr, desired)
}
in pkg/sql/opt/optbuilder.(*Builder).analyzeSelectList
b.analyzeSelectList(selects, desiredTypes, inScope, outScope)
}
in pkg/sql/opt/optbuilder.(*Builder).analyzeProjectionList
// aggInScope and aggOutScope.
b.analyzeProjectionList(sel.Exprs, desiredTypes, fromScope, projectionsScope)
in pkg/sql/opt/optbuilder.(*Builder).buildSelectClause
case *tree.SelectClause:
outScope = b.buildSelectClause(t, orderBy, locking, desiredTypes, inScope)
in pkg/sql/opt/optbuilder.(*Builder).buildSelectStmtWithoutParens
return b.processWiths(with, inScope, func(inScope *scope) *scope {
return b.buildSelectStmtWithoutParens(
wrapped, orderBy, limit, locking, desiredTypes, inScope,
in pkg/sql/opt/optbuilder.(*Builder).buildSelect.func1
inScope.atRoot = false
outScope := buildStmt(inScope)
inScope.atRoot = prevAtRoot
in pkg/sql/opt/optbuilder.(*Builder).processWiths
return b.processWiths(with, inScope, func(inScope *scope) *scope {
return b.buildSelectStmtWithoutParens(
in pkg/sql/opt/optbuilder.(*Builder).buildSelect
case *tree.Select:
return b.buildSelect(stmt, noRowLocking, desiredTypes, inScope)
in pkg/sql/opt/optbuilder.(*Builder).buildStmt
return b.buildStmt(stmt, desiredTypes, inScope)
}
in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot
// and physical properties.
outScope := b.buildStmtAtRoot(b.stmt, nil /* desiredTypes */, b.allocScope())
in pkg/sql/opt/optbuilder.(*Builder).Build
bld := optbuilder.New(ctx, &p.semaCtx, p.EvalContext(), &opc.catalog, f, opc.p.stmt.AST)
if err := bld.Build(); err != nil {
return nil, err
in pkg/sql.(*optPlanningCtx).buildExecMemo
execMemo, err := opc.buildExecMemo(ctx)
if err != nil {
in pkg/sql.(*planner).makeOptimizerPlan
if err := planner.makeOptimizerPlan(ctx); err != nil {
log.VEventf(ctx, 1, "optimizer plan failed: %v", err)
in pkg/sql.(*connExecutor).makeExecPlan
// between here and there needs to happen even if there's an error.
err := ex.makeExecPlan(ctx, planner)
// We'll be closing the plan manually below after execution; this
in pkg/sql.(*connExecutor).dispatchToExecutionEngine
p.autoCommit = os.ImplicitTxn.Get() && !ex.server.cfg.TestingKnobs.DisableAutoCommit
if err := ex.dispatchToExecutionEngine(ctx, p, res); err != nil {
return nil, nil, err
in pkg/sql.(*connExecutor).execStmtInOpenState
} else {
ev, payload, err = ex.execStmtInOpenState(ctx, stmt, res, pinfo)
}
in pkg/sql.(*connExecutor).execStmt
stmtCtx := withStatement(ctx, ex.curStmt)
ev, payload, err = ex.execStmt(stmtCtx, curStmt, stmtRes, nil /* pinfo */)
if err != nil {
in pkg/sql.(*connExecutor).execCmd
var err error
if err = ex.execCmd(ex.Ctx()); err != nil {
if err == io.EOF || err == errDrainingComplete {
in pkg/sql.(*connExecutor).run
}()
return h.ex.run(ctx, s.pool, reserved, cancel)
}
in pkg/sql.(*Server).ServeConn
reservedOwned = false // We're about to pass ownership away.
retErr = sqlServer.ServeConn(ctx, connHandler, reserved, cancelConn)
}()
in pkg/sql/pgwire.(*conn).processCommandsAsync.func1
/usr/local/go/src/runtime/asm_amd64.s#L1356-L1358 in runtime.goexit

pkg/sql/sem/tree/parse_string.go in pkg/sql/sem/tree.ParseAndRequireString at line 71
pkg/sql/sem/tree/parse_array.go in pkg/sql/sem/tree.(*parseState).parseElement at line 139
pkg/sql/sem/tree/parse_array.go in pkg/sql/sem/tree.doParseDArrayFromString at line 174
pkg/sql/sem/tree/parse_array.go in pkg/sql/sem/tree.ParseDArrayFromString at line 150
pkg/sql/sem/tree/parse_string.go in pkg/sql/sem/tree.ParseAndRequireString at line 24
pkg/sql/sem/tree/constant.go in pkg/sql/sem/tree.(*StrVal).ResolveAsType at line 543
pkg/sql/sem/tree/constant.go in pkg/sql/sem/tree.typeCheckConstant at line 65
pkg/sql/sem/tree/type_check.go in pkg/sql/sem/tree.(*StrVal).TypeCheck at line 1235
pkg/sql/sem/tree/type_check.go in pkg/sql/sem/tree.(*IndirectionExpr).TypeCheck at line 503
pkg/sql/sem/tree/type_check.go in pkg/sql/sem/tree.TypeCheck at line 261
pkg/sql/opt/optbuilder/scope.go in pkg/sql/opt/optbuilder.(*scope).resolveType at line 424
pkg/sql/opt/optbuilder/project.go in pkg/sql/opt/optbuilder.(*Builder).analyzeSelectList at line 150
pkg/sql/opt/optbuilder/project.go in pkg/sql/opt/optbuilder.(*Builder).analyzeProjectionList at line 84
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelectClause at line 929
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelectStmtWithoutParens at line 867
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelect.func1 at line 840
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).processWiths at line 29
pkg/sql/opt/optbuilder/select.go in pkg/sql/opt/optbuilder.(*Builder).buildSelect at line 839
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 253
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 217
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 188
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildExecMemo at line 433
pkg/sql/plan_opt.go in pkg/sql.(*planner).makeOptimizerPlan at line 169
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).makeExecPlan at line 856
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).dispatchToExecutionEngine at line 746
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmtInOpenState at line 536
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmt at line 96
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1406
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1335
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 479
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommandsAsync.func1 at line 582
/usr/local/go/src/runtime/asm_amd64.s in runtime.goexit at line 1357
Tag Value
Cockroach Release v20.1.5
Cockroach SHA: f990441
Platform linux amd64
Distribution CCL
Environment v20.1.5
Command server
Go Version go1.13.9
# of CPUs 2
# of Goroutines 307
@cockroach-teamcity cockroach-teamcity added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report. labels Jan 14, 2021
@yuzefovich
Copy link
Member

yuzefovich commented Jan 15, 2021

Seems related to #52134. @RaduBerinde do you think it's worth backporting #52416 to 20.1 and whether it would fix it?

@yuzefovich yuzefovich changed the title sentry: *errors.errorString *safedetails.withSafeDetails: unknown type %s (%T) (1) parse_string.go:71: *withstack.withStack (2) *assert.withAssertionFailure *errutil.withMessage *safedetails.withSafeDetails: could not parse %q as type %s (3) datum.go:252: *withstack.withStack (4) *pgerror.withCandidateCode: 22P02 (5) (check the extra data payloads) sql: v20.1.5: unknown type when parsing string as an array element Jan 15, 2021
@RaduBerinde
Copy link
Member

I think it would, opened #59066.

@RaduBerinde
Copy link
Member

Should be fixed by #59066.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Projects
None yet
Development

No branches or pull requests

3 participants