Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Bug Fixes
* Respect `--logfile` when using `--execute` or standard input at the shell CLI.
* Gracefully catch Paramiko parsing errors on `--list-ssh-config`.
* Downgrade to Paramiko 3.5.1 to avoid crashing on DSA SSH keys.
* Offer schema name completions in `GRANT ... ON` forms.


1.44.2 (2026/01/13)
Expand Down
3 changes: 2 additions & 1 deletion mycli/packages/completion_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,9 @@ def suggest_based_on_last_token(

# The lists of 'aliases' could be empty if we're trying to complete
# a GRANT query. eg: GRANT SELECT, INSERT ON <tab>
# In that case we just suggest all tables.
# In that case we just suggest all schemata and all tables.
if not aliases:
suggest.append({"type": "database"})
suggest.append({"type": "table", "schema": parent})
return suggest

Expand Down
13 changes: 13 additions & 0 deletions test/test_smart_completion_public_schema_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,19 @@ def test_un_escaped_table_names(completer, complete_event):
)


# todo: the fixtures are insufficient; the database name should also appear in the result
def test_grant_on_suggets_tables_and_schemata(completer, complete_event):
text = "GRANT ALL ON "
position = len(text)
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
assert result == [
Completion(text='users', start_position=0),
Completion(text='orders', start_position=0),
Completion(text='`select`', start_position=0),
Completion(text='`réveillé`', start_position=0),
]


def dummy_list_path(dir_name):
dirs = {
"/": [
Expand Down