Stabilize formatting of invalid WHERE clauses.
This commit is contained in:
parent
f578d03ef7
commit
11a6b7db8b
|
@ -24,6 +24,7 @@ Bug Fixes
|
|||
* Fix splitting when using DECLARE ... HANDLER (issue581).
|
||||
* Fix splitting of statements using CASE ... WHEN (issue580).
|
||||
* Improve formatting of type casts in parentheses.
|
||||
* Stabilize formatting of invalid SQL statements.
|
||||
|
||||
|
||||
Release 0.3.1 (Feb 29, 2020)
|
||||
|
|
|
@ -102,7 +102,10 @@ class ReindentFilter:
|
|||
|
||||
def _process_where(self, tlist):
|
||||
tidx, token = tlist.token_next_by(m=(T.Keyword, 'WHERE'))
|
||||
if not token:
|
||||
return
|
||||
# issue121, errors in statement fixed??
|
||||
print(tidx, token, tlist)
|
||||
tlist.insert_before(tidx, self.nl())
|
||||
|
||||
with indent(self):
|
||||
|
|
|
@ -405,3 +405,9 @@ def test_as_in_parentheses_indents():
|
|||
# did raise NoneType has no attribute is_group in _process_parentheses
|
||||
formatted = sqlparse.format('(as foo)', reindent=True)
|
||||
assert formatted == '(as foo)'
|
||||
|
||||
|
||||
def test_format_invalid_where_clause():
|
||||
# did raise ValueError
|
||||
formatted = sqlparse.format('where, foo', reindent=True)
|
||||
assert formatted == 'where, foo'
|
||||
|
|
Loading…
Reference in New Issue