tconbeer / sqlfmt

sqlfmt formats your dbt SQL files so you don't have to
https://sqlfmt.com
Apache License 2.0
390 stars 16 forks source link

Incorrectly formats variable assignation #502

Closed federico-hero closed 10 months ago

federico-hero commented 10 months ago

Describe the bug

Incorrectly formats variable assignation operator := as : =.

To Reproduce

Run this correct SQL through sqlfmt:

select partman.create_parent( 'public.deliveries_finished', 'created_at', 'native', 'daily', p_premake := 20) ;

Expected behavior

select
    partman.create_parent(
        'public.deliveries_finished', 'created_at', 'native', 'daily', p_premake := 20
    )
;

Actual behavior

Notice the separation between the colon and the equal sign:

select
    partman.create_parent(
        'public.deliveries_finished', 'created_at', 'native', 'daily', p_premake: = 20
    )
;

Additional context

sqlfmt, version 0.20.0

This makes the SQL to fail.

tconbeer commented 10 months ago

Thanks for the report. Is this MySQL?

federico-hero commented 10 months ago

This is Postgres (PL/pgSQL).