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

Internal error for ILIKE_ESCAPE and special characters #44621

Closed
mrigger opened this issue Feb 1, 2020 · 0 comments · Fixed by #44633
Closed

Internal error for ILIKE_ESCAPE and special characters #44621

mrigger opened this issue Feb 1, 2020 · 0 comments · Fixed by #44633
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases.

Comments

@mrigger
Copy link

mrigger commented Feb 1, 2020

Consider the following testcase:

SELECT ILIKE_ESCAPE('a', '', ''); -- internal error: runtime error: index out of range [2] with length 1

Unexpectedly, the query results in an internal error with the following stacktrace:

ERROR: internal error: runtime error: index out of range [2] with length 1
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/util/errorutil/catch.go:29: ShouldCatch()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:169: func1()
runtime/panic.go:679: gopanic()
runtime/panic.go:75: goPanicIndex()
unicode/utf8/utf8.go:355: EncodeRune()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:4862: replaceCustomEscape()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:5090: Pattern()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/regexp_cache.go:62: GetRegexp()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:2521: ConvertLikeToRegexp()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:2503: MatchLikeEscape()
github.com/cockroachdb/cockroach/pkg/sql/sem/builtins/builtins.go:1194: func79()
github.com/cockroachdb/cockroach/pkg/sql/sem/builtins/builtins.go:4552: func1()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:4008: Eval()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/fold_constants.go:353: FoldFunction()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:13856: ConstructFunction()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/scalar.go:476: buildFunction()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/scalar.go:290: buildScalar()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/project.go:171: buildProjectionList()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:930: buildSelectClause()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:850: buildSelectStmtWithoutParens()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:823: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:29: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:822: buildSelect()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:253: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:217: buildStmtAtRoot()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:188: Build()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:420: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:162: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:795: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:678: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:471: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:101: execStmt()

I found this bug based on commit 031ab37f38a9095da3740c13a5ac03531f13608c.

@yuzefovich yuzefovich added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Feb 1, 2020
@yuzefovich yuzefovich self-assigned this Feb 1, 2020
@knz knz added O-community Originated from the community S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases. labels Feb 1, 2020
@craig craig bot closed this as completed in 46372d4 Feb 3, 2020
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-community Originated from the community S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants