bug: Closing bracket not closed with nested brackets
Closed this issue · 1 comments
MattiasMTS commented
Describe the bug
I have a bug with nested brackets []
and ()
in a sql statement like this:
select *,
array[
(
my_key || '_' || (blob #>> '{key,value}'),
)
] as new_blob
from my_table
Because I have newline after teh array[
and parenthesis around the (blob #>> '{key,value}')
, this one fails to format the file with the following error:
sqlfmt encountered an error: Closing bracket ']' found at 164 does not match last opened bracket '(' found at 77.
If you write the sql statement as such:
select *,
array[ ( my_key || '_' || (blob #>> '{key,value}'),) ] as new_blob
from my_table
It actually formats the query but it looks very weird, output:
select
*,
array[
(
my_key
|| '_'
|| (
blob # >> '{key,value}'),) ] as new_blob
from my_table
To Reproduce
See above for code to use.
Expected behavior
I expect that the formatting should work with nested brackets.
Actual behavior
See actual behavor above.
Additional context
v0.24.0