diff options
author | Darik Gamble <darik.gamble@gmail.com> | 2015-01-20 17:06:54 -0500 |
---|---|---|
committer | Darik Gamble <darik.gamble@gmail.com> | 2015-01-20 17:06:54 -0500 |
commit | eb66d8b3e050f13f1057b194b72393772692c3da (patch) | |
tree | 149286ee2f266e934403c80d367f8a7444b9b344 | |
parent | ab7edd955cc89f6582c88461ea8614c36d86ca41 (diff) |
fix bug where columns from a nonvisible table could contribute suggestions when a a query references an unqualifed, visible table of the same name
-rw-r--r-- | pgcli/pgcompleter.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py index c50725e9..33e20e8e 100644 --- a/pgcli/pgcompleter.py +++ b/pgcli/pgcompleter.py @@ -200,8 +200,10 @@ class PGCompleter(Completer): # Only allow unqualified table reference on visible tables vis_tables = self.tables[self.tables['is_visible']] - unqualed_tables = scoped_tbls.merge(vis_tables, how='inner', on=['table']) - unqualed = unqualed_tables.merge(columns, how='inner', on=['table']) + unqualed_tables = scoped_tbls.merge(vis_tables, + how='inner', on=['table'], suffixes=['_left', '_right']) + unqualed_tables['schema'] = unqualed_tables['schema_right'] + unqualed = unqualed_tables.merge(columns, how='inner', on=['schema', 'table']) return list(qualed['column']) + list(unqualed['column']) |