Skip to content

Commit d67c442

Browse files
committed
Merge pull request andialbrecht#321 from romainr/patch-1
Putting LIMIT on a new line andialbrecht#320
2 parents 8e039bc + 18dbc4d commit d67c442

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Alphabetical list of contributors:
3232
3333
* Robert Nix <[email protected]>
3434
* Rocky Meza <[email protected]>
35+
* Romain Rigaux <[email protected]>
3536
* Ryan Wooden <[email protected]>
3637
3738
* Shen Longxing <[email protected]>

sqlparse/filters/reindent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def nl(self, offset=0):
5151
def _next_token(self, tlist, idx=-1):
5252
split_words = ('FROM', 'STRAIGHT_JOIN$', 'JOIN$', 'AND', 'OR',
5353
'GROUP', 'ORDER', 'UNION', 'VALUES',
54-
'SET', 'BETWEEN', 'EXCEPT', 'HAVING')
54+
'SET', 'BETWEEN', 'EXCEPT', 'HAVING', 'LIMIT')
5555
m_split = T.Keyword, split_words, True
5656
tidx, token = tlist.token_next_by(m=m_split, idx=idx)
5757

tests/test_regressions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ def test_issue34(value):
4343

4444

4545
def test_issue35():
46-
# missing space before LIMIT
46+
# missing space before LIMIT. Updated for #321
4747
sql = sqlparse.format("select * from foo where bar = 1 limit 1",
4848
reindent=True)
4949
assert sql == "\n".join([
5050
"select *",
5151
"from foo",
52-
"where bar = 1 limit 1"])
52+
"where bar = 1",
53+
"limit 1"])
5354

5455

5556
def test_issue38():

0 commit comments

Comments
 (0)