cockroachdb / cockroachdb/cockroach
cli/sql: avoid ad-hoc parsing to match special input cases
Open
A-cli-client
C-bug
T-sql-foundations
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
In #94408 we've introduced a regular expression in the SQL shell.
In commit fb09e01eeacfb74ad9d25358ec8047759cfe836c we've introduced a mini-parser in the SQL shell go package.
Both of these things are architecturally incorrect -- we should have the server inspect the SQL syntax, as only the server has precise knowledge of the grammar that it recognizes.
There's a couple of solutions we can consider:
- lex and match the lexed tokens
- extend SHOW SYNTAX to reveals the token (using `parser.Tokens()`) in addition to the parsed syntax / errors
Jira issue: CRDB-24732
Epic CRDB-23743
Contributor guide
Assessment
This issue has not been assessed yet.