cockroachdb / cockroachdb/cockroach

cli/sql: avoid ad-hoc parsing to match special input cases

Open
#97,508 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.