Skip to content

Commit d935d2d

Browse files
fix: add VERSION to builtin function completion (#1574)
* fix: add VERSION to builtin function completion * docs: add changelog entry for VERSION completion * docs: Update changelog.rst Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c84d913 commit d935d2d

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Features:
88
reflects the current editing mode: beam in INSERT, block in NORMAL, underline in REPLACE.
99
Uses prompt_toolkit's ``ModalCursorShapeConfig``.
1010

11+
Bug fixes:
12+
----------
13+
* Add `VERSION` to built-in function completion so `SELECT VERSION();` is suggested.
14+
1115
4.4.0 (2025-12-24)
1216
==================
1317

pgcli/packages/pgliterals/pgliterals.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@
439439
"TRUNC",
440440
"UNNEST",
441441
"UPPER",
442+
"VERSION",
442443
"WIDTH",
443444
"WIDTH_BUCKET",
444445
"XMLAGG"

tests/test_naive_completion.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ def test_function_name_completion(completer, complete_event):
4949
])
5050

5151

52+
def test_version_function_name_completion(completer, complete_event):
53+
text = "SELECT VE"
54+
position = len(text)
55+
result = completions_to_set(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
56+
assert result == completions_to_set([Completion(text="VERSION", start_position=-2)])
57+
58+
5259
def test_column_name_completion(completer, complete_event):
5360
text = "SELECT FROM users"
5461
position = len("SELECT ")

tests/test_smart_completion_public_schema_only.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ def test_builtin_function_name_completion(completer):
160160
])
161161

162162

163+
@parametrize("completer", completers())
164+
def test_builtin_version_function_completion(completer):
165+
result = get_result(completer, "SELECT VE")
166+
assert completions_to_set(result) == completions_to_set([function("VERSION", -2)])
167+
168+
163169
@parametrize("completer", completers())
164170
def test_builtin_function_matches_only_at_start(completer):
165171
text = "SELECT IN"

0 commit comments

Comments
 (0)