Currently,
SELECT CASE
WHEN looooooooooooooooooong_column_name = 1
THEN another_loooooooooooooong_column_name
END;
Is formatted as
SELECT CASE
WHEN looooooooooooooooooong_column_name = 1 THEN another_loooooooooooooong_column_name
END;
Which makes it a bit hard to find the THEN, especially when there are many WHEN clauses. It'd be nice to line-break these, but that introduces a smaller issue when there are multiple WHEN clauses (as WHEN looks very similar to THEN), so perhaps an indented THEN, or a line-break between WHEN clauses?
SELECT CASE
WHEN looooooooooooooooooong_column_name = 1
THEN another_loooooooooooooong_column_name
WHEN looooooooooooooooooong_column_name = 1
THEN another_loooooooooooooong_column_name
ELSE foo
END;
-- Or this?
SELECT CASE
WHEN looooooooooooooooooong_column_name = 1
THEN another_loooooooooooooong_column_name
WHEN looooooooooooooooooong_column_name = 1
THEN another_loooooooooooooong_column_name
ELSE foo
END;
Worth noting, the WHEN clause could also contain multiple conditions, which would probably need to be indented:
SELECT CASE
WHEN
looooooooooooooooooong_column_name = 1
AND another_column_name = 2
THEN another_loooooooooooooong_column_name
WHEN
looooooooooooooooooong_column_name = 1
AND another_column_name = 2
THEN another_loooooooooooooong_column_name
END;
-- Currently this are formatted as:
SELECT
CASE
WHEN looooooooooooooooooong_column_name = 1
AND another_column_name = 2 THEN another_loooooooooooooong_column_name
WHEN looooooooooooooooooong_column_name = 1
AND another_column_name = 2 THEN another_loooooooooooooong_column_name
END;
Currently,
Is formatted as
Which makes it a bit hard to find the
THEN, especially when there are manyWHENclauses. It'd be nice to line-break these, but that introduces a smaller issue when there are multiple WHEN clauses (as WHEN looks very similar to THEN), so perhaps an indented THEN, or a line-break between WHEN clauses?Worth noting, the WHEN clause could also contain multiple conditions, which would probably need to be indented: