Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Closing bracket not closed with nested brackets #652

Closed
MattiasMTS opened this issue Nov 29, 2024 · 1 comment
Closed

bug: Closing bracket not closed with nested brackets #652

MattiasMTS opened this issue Nov 29, 2024 · 1 comment

Comments

@MattiasMTS
Copy link

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

@tconbeer
Copy link
Owner

This is a duplicate of #461

(Sorry)

@tconbeer tconbeer closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants