summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith@netflix.com>2021-05-06 21:09:45 -0700
committerAmjith Ramanujam <amjith@netflix.com>2021-05-06 21:12:48 -0700
commit1d2570f462a565e5034658000c6cbb60f259b2dc (patch)
treede4991e8c180c14e35a6e58d907bf1c54e0c01b4
parent0ada5a6c6aa1ca1d1e028f00691862629f521308 (diff)
Include functions from search_path in completion.
-rw-r--r--changelog.rst1
-rw-r--r--pgcli/packages/pgliterals/pgliterals.json2
-rw-r--r--pgcli/pgcompleter.py19
3 files changed, 14 insertions, 8 deletions
diff --git a/changelog.rst b/changelog.rst
index 4fd6fb28..21941499 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -7,6 +7,7 @@ Features:
* Consider `update` queries destructive and issue a warning. Change
`destructive_warning` setting to `all|moderate|off`, vs `true|false`. (#1239)
* Skip initial comment in .pg_session even if it doesn't start with '#'
+* Include functions from schemas in search_path. (`Amjith Ramanujam`_)
Bug fixes:
----------
diff --git a/pgcli/packages/pgliterals/pgliterals.json b/pgcli/packages/pgliterals/pgliterals.json
index 5c292e6d..df00817a 100644
--- a/pgcli/packages/pgliterals/pgliterals.json
+++ b/pgcli/packages/pgliterals/pgliterals.json
@@ -327,8 +327,6 @@
"FIRST_VALUE",
"FLOOR",
"FORMAT",
- "GENERATE_SERIES",
- "GENERATE_SUBSCRIPTS",
"GET_BIT",
"GET_BYTE",
"HEIGHT",
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py
index 79be274e..269b810f 100644
--- a/pgcli/pgcompleter.py
+++ b/pgcli/pgcompleter.py
@@ -491,11 +491,14 @@ class PGCompleter(Completer):
def get_column_matches(self, suggestion, word_before_cursor):
tables = suggestion.table_refs
- do_qualify = suggestion.qualifiable and {
- "always": True,
- "never": False,
- "if_more_than_one_table": len(tables) > 1,
- }[self.qualify_columns]
+ do_qualify = (
+ suggestion.qualifiable
+ and {
+ "always": True,
+ "never": False,
+ "if_more_than_one_table": len(tables) > 1,
+ }[self.qualify_columns]
+ )
qualify = lambda col, tbl: (
(tbl + "." + self.case(col)) if do_qualify else self.case(col)
)
@@ -703,7 +706,11 @@ class PGCompleter(Completer):
not f.is_aggregate
and not f.is_window
and not f.is_extension
- and (f.is_public or f.schema_name == suggestion.schema)
+ and (
+ f.is_public
+ or f.schema_name in self.search_path
+ or f.schema_name == suggestion.schema
+ )
)
else: