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

@ -32,5 +32,6 @@ Bug fixes
| `Bug #3798 <https://redmine.postgresql.org/issues/3798>`_ - Ensure the browser toolbar buttons work in languages other than English.
| `Bug #3805 <https://redmine.postgresql.org/issues/3805>`_ - Allow horizontal sizing of the edit grid text pop-out.
| `Bug #3809 <https://redmine.postgresql.org/issues/3809>`_ - Ensure auto complete should works when first identifier in the FROM clause needs quoting.
| `Bug #3810 <https://redmine.postgresql.org/issues/3810>`_ - Ensure auto complete should works for columns from a schema-qualified table.
| `Bug #3821 <https://redmine.postgresql.org/issues/3821>`_ - Ensure identifiers are properly displayed in the plan viewer.
| `Bug #3830 <https://redmine.postgresql.org/issues/3830>`_ - Make the setup process more robust against aborted executions.

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 {