Skip to content

[bug] Fix crash for completion edge case (#1668)#1673

Merged
scottnemes merged 2 commits intodbcli:mainfrom
scottnemes:bug/1668/fix-completion-crash
Mar 4, 2026
Merged

[bug] Fix crash for completion edge case (#1668)#1673
scottnemes merged 2 commits intodbcli:mainfrom
scottnemes:bug/1668/fix-completion-crash

Conversation

@scottnemes
Copy link
Contributor

@scottnemes scottnemes commented Mar 4, 2026

Description

Fixes crash on completion edge case described in #1668.

Underlying issue is that sqlparse has its own set of "keywords", and it appears that this means some columns that match like column_name in this case get parsed as the type Token vs the more specific type Identifier. I added logic to check this and in the case of a Token like column_name it will just return the value.

https://github.com/andialbrecht/sqlparse/blob/897eb2df8c0608b9ee4682e9728f669adf13595e/sqlparse/keywords.py#L175

Fixes #1668

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

  1. Medium: Missing regression test for the fixed crash path

No security issues were introduced in the diff.
No other clear correctness regressions were identified from the changed lines, but risk remains until the crash scenario is locked by test coverage.

@scottnemes scottnemes self-assigned this Mar 4, 2026
@scottnemes scottnemes requested a review from rolandwalker March 4, 2026 06:08
@scottnemes scottnemes merged commit a423c80 into dbcli:main Mar 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeatable completions crash

2 participants