1
0
Fork 0

Include functions from search_path in completion.

This commit is contained in:
Amjith Ramanujam 2021-05-06 21:09:45 -07:00
parent 0ada5a6c6a
commit 1d2570f462
3 changed files with 14 additions and 8 deletions

View File

@ -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:
----------

View File

@ -327,8 +327,6 @@
"FIRST_VALUE",
"FLOOR",
"FORMAT",
"GENERATE_SERIES",
"GENERATE_SUBSCRIPTS",
"GET_BIT",
"GET_BYTE",
"HEIGHT",

View File

@ -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: