sqlformat-rs icon indicating copy to clipboard operation
sqlformat-rs copied to clipboard

Be consistent with the spacing after reserved keywords

Open lu-zero opened this issue 9 months ago • 1 comments

From the tests

            "
            INSERT INTO some_table (id_product, id_shop, id_currency, id_country, id_registration) (
            SELECT IF(dq.id_discounter_shopping = 2, dq.value, dq.value / 100),
            IF (dq.id_discounter_shopping = 2, 'amount', 'percentage') FROM foo);"
            "
            INSERT INTO
              some_table (
                id_product,
                id_shop,
                id_currency,
                id_country,
                id_registration
              ) (
                SELECT
                  IF(
                    dq.id_discounter_shopping = 2,
                    dq.value,
                    dq.value / 100
                  ),
                  IF (
                    dq.id_discounter_shopping = 2,
                    'amount',
                    'percentage'
                  )
                FROM
                  foo
              );"

The two IF have different spacing, would be better to either have 1 space always or none always.

lu-zero avatar Jan 15 '25 10:01 lu-zero