Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: fix mysql keyword quoting (#15195)

Vincent Huang87710710b493
diff --git a/backend/api/lsp/completion.go b/backend/api/lsp/completion.go
index 9f72b853dd..785603c5b5 100644
--- a/backend/api/lsp/completion.go
+++ b/backend/api/lsp/completion.go
@@ -79,7 +79,7 @@ func (h *Handler) handleTextDocumentCompletion(ctx context.Context, _ *jsonrpc2.
for _, candidate := range candidates {
label := candidate.Text
// Remove the double quote if it's quoted.
- if len(label) > 1 && label[0] == '"' && label[len(label)-1] == '"' {
+ if len(label) > 1 && label[0] == '"' && label[len(label)-1] == '"' || label[0] == '`' && label[len(label)-1] == '`' {
label = label[1 : len(label)-1]
}
completionItem := lsp.CompletionItem{
diff --git a/backend/plugin/parser/mysql/completion.go b/backend/plugin/parser/mysql/completion.go
index 5bc7ef77f5..9742b888eb 100644
--- a/backend/plugin/parser/mysql/completion.go
+++ b/backend/plugin/parser/mysql/completion.go
@@ -1490,7 +1490,7 @@ func (c *Completer) quotedIdentifierIfNeeded(s string) string {
if c.caretTokenIsQuoted {
return s
}
- if c.lexer.IsReservedKeyword(s) {
+ if c.lexer.IsReservedKeyword(strings.ToUpper(s)) {
return fmt.Sprintf("`%s`", s)
}
for _, r := range s {