Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not escape the upper case names #218

Merged
merged 2 commits into from
Mar 2, 2025
Merged

Conversation

kracekumar
Copy link
Contributor

@kracekumar kracekumar commented Mar 2, 2025

Description

  • Previously when the table was upper case, the escaped name had a back tick.
  • Now it skips by modifying the regex to mathc the pattern
  • screenshot
Screenshot 2025-03-02 at 2 52 28 pm Screenshot 2025-03-02 at 2 52 41 pm

Checklist

  • I've added this contribution to the CHANGELOG.md file.

@@ -302,7 +314,7 @@ def test_auto_escaped_col_names(completer, complete_event):
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
assert result == [
Completion(text="*", start_position=0),
Completion(text="`ABC`", start_position=0),
Completion(text="ABC", start_position=0),
Copy link
Contributor Author

@kracekumar kracekumar Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous tests were escaping the upper case column name and not sure why though. If there is a solid case, we can close this PR. I don't see any issue of passing upper case as is to sqlite3.

sqlite> .open :memory;
sqlite> create table TEST(ID int);
sqlite> insert into TEST(1);
Parse error: near "1": syntax error
  insert into TEST(1);
                   ^--- error here
sqlite> insert into TEST values(1);
sqlite> select ID from TEST;
1
sqlite>

@kracekumar kracekumar requested a review from amjith March 2, 2025 15:30
@amjith
Copy link
Member

amjith commented Mar 2, 2025

I believe the escaping was borrowed from pgcli (or mycli). I think Postgres treats quoted names case sensitive and lower cases them of they are not quoted.

@amjith amjith merged commit 768be79 into main Mar 2, 2025
7 checks passed
@amjith amjith deleted the krace/issue-185-remove-backtick branch March 2, 2025 19:00
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.

Autocompleting tables and columns that are all caps should not add backticks
2 participants