Quote Postgres autocomplete suggestions for mixed-case identifiers#268
Open
Maxteabag wants to merge 1 commit into
Open
Quote Postgres autocomplete suggestions for mixed-case identifiers#268Maxteabag wants to merge 1 commit into
Maxteabag wants to merge 1 commit into
Conversation
Postgres folds unquoted identifiers to lowercase, so accepting autocomplete for PascalCase tables or camelCase columns produced SQL that failed against real schemas. The fix keeps raw schema metadata for lookup and lazy loading, but formats dropdown insertion text through a dialect hook. The default hook preserves existing behavior; Postgres quotes only identifiers that are not safe lowercase unquoted names. Constraint: PostgreSQL quoted identifiers preserve case while unquoted identifiers fold to lowercase Rejected: Quote every autocomplete identifier | too noisy and would degrade normal lowercase workflows Rejected: Rewrite schema cache entries as quoted names | risks breaking raw metadata lookup and column loading Confidence: high Scope-risk: moderate Directive: Keep autocomplete display formatting separate from raw schema metadata unless lookup tests are updated alongside it Tested: uv run ruff check sqlit/domains/connections/providers/adapters/base.py sqlit/domains/connections/providers/postgresql/base.py sqlit/domains/query/ui/mixins/autocomplete_suggestions.py tests/integration/test_autocomplete_postgresql_schema.py Tested: uv run mypy sqlit/domains/connections/providers/adapters/base.py sqlit/domains/connections/providers/postgresql/base.py sqlit/domains/query/ui/mixins/autocomplete_suggestions.py Tested: uv run --extra postgres pytest tests/integration/test_autocomplete_postgresql_schema.py tests/unit/test_autocomplete_multidb.py tests/unit/test_autocomplete_alias_multi_db.py tests/unit/sql_completion tests/test_autocomplete_database_modes.py tests/ui/test_autocomplete_dropdown.py tests/integration/test_autocomplete_mysql_columns.py -q Not-tested: Full provider integration matrix beyond autocomplete-focused tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #262.