cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.58k stars 3.71k forks source link

cli: internal error with multiline stmt #92923

Closed yuzefovich closed 1 year ago

yuzefovich commented 1 year ago

On 317d7c03e19a6df9dd317ab40ed80d4643e1f918 in empty demo when I copy this multiline stmt

SELECT
    count(*)
FROM
    pg_type AS t
WHERE
    t.typrelid = 0
    AND NOT EXISTS(SELECT 1 FROM pg_type AS el WHERE el.oid = t.typelem AND el.typarray = t.oid)
    AND t.typname LIKE 'myt%'

into CLI, it results in an internal error:

Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
    GOROOT/src/runtime/debug/stack.go:24 +0x64
runtime/debug.PrintStack()
    GOROOT/src/runtime/debug/stack.go:16 +0x1c
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func3()
    github.com/charmbracelet/bubbletea/external/com_github_charmbracelet_bubbletea/tea.go:254 +0x8c
panic({0x106368820, 0x1098e6330})
    GOROOT/src/runtime/panic.go:890 +0x258
github.com/knz/bubbline/complete.(*Model).SetValues(0x1400301cd88, {0x0?, 0x0})
    github.com/knz/bubbline/complete/external/com_github_knz_bubbline/complete/complete.go:263 +0xa8
github.com/knz/bubbline/editline.(*Model).autoComplete(0x1400301c000)
    github.com/knz/bubbline/editline/external/com_github_knz_bubbline/editline/editline.go:594 +0x24c
...

Jira issue: CRDB-22054

yuzefovich commented 1 year ago

I'm guessing this is because of tab symbols in that SQL.

yuzefovich commented 1 year ago

dup of #92935