diff options
author | koljonen <koljonen@outlook.com> | 2016-06-28 10:40:14 +0200 |
---|---|---|
committer | Joakim Koljonen <koljonen@outlook.com> | 2017-03-09 01:41:11 +0100 |
commit | 1277752d6287225062ed6bdb32edb9fa8b82b2c8 (patch) | |
tree | eff32a691b08169049dcc3e2488beaa7e9029e06 /tests/test_smart_completion_multiple_schemata.py | |
parent | 4904a982dd9970f843a0c368d62de55cd6f1c0a4 (diff) |
Find statements inside function body
Consider this script
```
CREATE FUNCTION foo() returns text LANGUAGE SQL AS $func$
SELECT 1 FROM Bar;
SELECT <cursor> FROM Baz;
$func$;
```
The change here is that `SELECT <cursor> FROM Baz;` will be seen as the
current statement, instead of the whole function definition.
This means we'll no longer get column suggestions from `Bar`.
Diffstat (limited to 'tests/test_smart_completion_multiple_schemata.py')
-rw-r--r-- | tests/test_smart_completion_multiple_schemata.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_smart_completion_multiple_schemata.py b/tests/test_smart_completion_multiple_schemata.py index 2d2d599a..86875047 100644 --- a/tests/test_smart_completion_multiple_schemata.py +++ b/tests/test_smart_completion_multiple_schemata.py @@ -387,6 +387,17 @@ def test_wildcard_column_expansion_with_alias_qualifier(completer, complete_even assert expected == completions @pytest.mark.parametrize('text', [ + ''' + SELECT count(1) FROM users; + CREATE FUNCTION foo(custom.products _products) returns custom.shipments + LANGUAGE SQL + AS $foo$ + SELECT 1 FROM custom.shipments; + INSERT INTO public.orders(*) values(-1, now(), 'preliminary'); + SELECT 2 FROM custom.users; + $foo$; + SELECT count(1) FROM custom.shipments; + ''', 'INSERT INTO public.orders(*', 'INSERT INTO public.Orders(*', 'INSERT INTO public.orders (*', |