summaryrefslogtreecommitdiff
path: root/dev-db/pgcli/files/pgcli-3.0.0-sqlparse.patch
blob: 4403a2e9c03784627cc1aeb522a26843afba320d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Taken from: https://github.com/dbcli/pgcli/pull/1224
Author: Kevin Marsh <kevinmarsh3@gmail.com>

--- a/pgcli/packages/parseutils/ctes.py
+++ b/pgcli/packages/parseutils/ctes.py
@@ -16,7 +16,7 @@
 def isolate_query_ctes(full_text, text_before_cursor):
     """Simplify a query by converting CTEs into table metadata objects"""
 
-    if not full_text:
+    if not full_text or not full_text.strip():
         return full_text, text_before_cursor, tuple()
 
     ctes, remainder = extract_ctes(full_text)
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@
     # see: https://github.com/dbcli/pgcli/pull/1197
     "prompt_toolkit>=2.0.6,<4.0.0",
     "psycopg2 >= 2.8",
-    "sqlparse >=0.3.0,<0.4",
+    "sqlparse >=0.3.0,<0.5",
     "configobj >= 5.0.6",
     "pendulum>=2.1.0",
     "cli_helpers[styles] >= 2.0.0",
--- a/tests/test_sqlcompletion.py
+++ b/tests/test_sqlcompletion.py
@@ -816,7 +816,7 @@ def test_create_db_with_template():
     assert set(suggestions) == set((Database(),))
 
 
-@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t"))
+@pytest.mark.parametrize("initial_text", ("", "    ", "\t \t", "\n"))
 def test_specials_included_for_initial_completion(initial_text):
     suggestions = suggest_type(initial_text, initial_text)