Skip to content

Commit

Permalink
fix: parse interval as word operator (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
tconbeer authored Jul 25, 2024
1 parent b39751c commit ee93c8d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Formatting Changes and Bug Fixes

- DuckDB's `union [all] by name` is now supported ([#611](https://github.com/tconbeer/sqlfmt/issues/611) - thank you [@aersam](https://github.com/aersam)!).
- `interval` is now parsed as a word operator. Parenthesized expressions like `interval (10) days` will maintain the space after `interval`.

## [0.21.4] - 2024-07-09

Expand Down
1 change: 1 addition & 0 deletions src/sqlfmt/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
r"filter",
r"grouping sets",
r"(not\s+)?in",
r"interval",
r"is(\s+not)?(\s+distinct\s+from)?",
r"isnull",
r"(not\s+)?i?like(\s+(any|all))?",
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/test_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def get_rule(ruleset: List[Rule], rule_name: str) -> Rule:
(MAIN, "word_operator", "in"),
(MAIN, "word_operator", "not in"),
(MAIN, "word_operator", "not\n\nin"),
(MAIN, "word_operator", "interval"),
(MAIN, "word_operator", "like"),
(MAIN, "word_operator", "not like"),
(MAIN, "word_operator", "ilike"),
Expand Down

0 comments on commit ee93c8d

Please sign in to comment.