From 5b20e107b8611fc8bddbebf8459af50ada759806 Mon Sep 17 00:00:00 2001 From: koljonen Date: Thu, 9 Jun 2016 23:38:33 +0200 Subject: Fix some join-condition issues When self-joining a table with an FK to or from some other table, we got a false FK-join suggestion for that column. There was also a problem with quoted tables not being quoted in the join condition. And there were a couple of problems when trying to join a non-existent table or using a non-existent qualifier (`SELECT * FROM Foo JOIN Bar ON Meow.`). I also rewrote get_join_condition_matches a bit in the process, hopefully making it a bit simpler. --- tests/test_smart_completion_multiple_schemata.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/test_smart_completion_multiple_schemata.py') diff --git a/tests/test_smart_completion_multiple_schemata.py b/tests/test_smart_completion_multiple_schemata.py index 9f74a7d4..b5ac0d3a 100644 --- a/tests/test_smart_completion_multiple_schemata.py +++ b/tests/test_smart_completion_multiple_schemata.py @@ -100,17 +100,18 @@ def test_schema_or_visible_table_completion(completer, complete_event): Completion(text='orders', start_position=0, display_meta='table')]) -@pytest.mark.parametrize('text', [ - 'SELECT FROM users', - 'SELECT FROM "users"', +@pytest.mark.parametrize('table', [ + 'users', + '"users"', ]) -def test_suggested_column_names_from_shadowed_visible_table(completer, complete_event, text): +def test_suggested_column_names_from_shadowed_visible_table(completer, complete_event, table): """ Suggest column and function names when selecting from table :param completer: :param complete_event: :return: """ + text = 'SELECT FROM ' + table position = len('SELECT ') result = set(completer.get_completions( Document(text=text, cursor_position=position), -- cgit v1.2.3