[FORMATTING] Allow dense formatting of multiple square brackets after another
Input data
Which SQL and options did you provide as input?
select foo['bar']['baz']['boz']
Expected Output
select
foo['bar']['baz']['boz']
Actual Output
select
foo['bar'] ['baz'] ['boz']
Usage
- How are you calling / using the library?
- I used the demo website
- What SQL language(s) does this apply to?
- I tested with
SnowflakeandPostgresql
- I tested with
- Which SQL Formatter version are you using?
- The latest one.
Infos
This is not breaking, afaik it works with spaces in between as well. However it looks a bit weird, so maybe we can figure this out?
Sorry for the late reply. It's definitely a bug.
There are likely several bugs in the handling of square brackets, as there have been many over time. Plus there is quite a bit of syntax variation between dialects as that's not part of standard SQL syntax. Will need to analyze this all more deeply to better understand this whole area of syntax to come up with a more solid solution.
More examples of how this shows up (unexpected spaces):
SELECT '{1,2,3}'::INT []
SELECT foo [1:2]
SELECT foo -> 'bar' -> 'baz'
Expected:
SELECT '{1,2,3}'::INT[]
SELECT foo[1:2]
SELECT foo->'bar'->'baz'