Ensure auto complete should works for columns from a schema-qualified table. Fixes #3810

This commit is contained in:
Akshay Joshi
2019-01-03 18:59:57 +05:30
parent 3a130d68c5
commit c455dda3ce
2 changed files with 9 additions and 3 deletions

View File

@@ -440,7 +440,7 @@ class SQLAutoComplete(object):
# Text starts with double quote; Remove quoting and
# match on everything that follows the double-quote.
item = self.unescape_name(item.lower())
match_point = item.lower().find(text, 0, match_end_limit)
match_point = item.find(text, 0, match_end_limit)
if match_point >= 0:
# Use negative infinity to force keywords to sort after all
# fuzzy matches
@@ -525,10 +525,15 @@ class SQLAutoComplete(object):
return result
def get_column_matches(self, suggestion, word_before_cursor):
schema = None
if len(suggestion.table_refs) > 0 and \
hasattr(suggestion.table_refs[0], 'schema') and \
suggestion.table_refs[0].schema != '':
schema = suggestion.table_refs[0].schema
# Tables and Views should be populated first.
self.fetch_schema_objects(None, 'tables')
self.fetch_schema_objects(None, 'views')
self.fetch_schema_objects(schema, 'tables')
self.fetch_schema_objects(schema, 'views')
tables = suggestion.table_refs
do_qualify = suggestion.qualifiable and {