diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2016-10-24 20:45:43 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2016-10-24 20:45:43 +0200 |
| commit | e0970cc54af6e441aabfea602e412428d02b7374 (patch) | |
| tree | d4f8a7daa4251abd6081d96032d1c0dfccb223a7 /sqlparse | |
| parent | b68e4b781b8d74b0222411e83a16408a83cde7d6 (diff) | |
| download | sqlparse-e0970cc54af6e441aabfea602e412428d02b7374.tar.gz | |
Fix an edge-case with subselects in CASE clauses.
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters/reindent.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sqlparse/filters/reindent.py b/sqlparse/filters/reindent.py index ff1b211..bf1f139 100644 --- a/sqlparse/filters/reindent.py +++ b/sqlparse/filters/reindent.py @@ -162,7 +162,8 @@ class ReindentFilter(object): with offset(self, len("WHEN ")): self._process_default(tlist) end_idx, end = tlist.token_next_by(m=sql.Case.M_CLOSE) - tlist.insert_before(end_idx, self.nl()) + if end_idx is not None: + tlist.insert_before(end_idx, self.nl()) def _process_default(self, tlist, stmts=True): self._split_statements(tlist) if stmts else None |
