SQL Formatter in 2018.2 is broken

Answered

Hi,

I recently upgraded IntelliJ IDEA Ultimate to 2018.2. Later I even did a clean install from Toolbox.

The SQL Code Style settings are different, but the result is much different from what it used to be in 2018.1.

Here's a sample query I formatted using 2018.1:

SELECT
1 AS val,
CASE WHEN 1 = 1
THEN 1
ELSE 0 END AS case1
FROM dv.bt_order AS bto
INNER JOIN dv.hs_order AS hso
ON (bto.h_order_hashkey = hso.h_order_hashkey AND hso.r_timestamp_end = '9999-12-31 00:00:00')
LEFT OUTER JOIN dv.hs_customer
ON (1 = 1)
WHERE 1 = 1
AND 2 = 2
GROUP BY 1;



Using exactly the same Code Style definition I get the following in 2018.2:

SELECT 1 AS val,
CASE
WHEN 1 = 1
THEN 1
ELSE 0
END AS case1
FROM dv.bt_order AS bto INNER JOIN dv.hs_order AS hso
ON (bto.h_order_hashkey = hso.h_order_hashkey AND hso.r_timestamp_end = '9999-12-31 00:00:00')
LEFT OUTER JOIN dv.hs_customer ON (1 = 1)
WHERE 1 = 1
AND 2 = 2
GROUP BY 1;

 

Do you know if I am missing a new definition I have to tweak? I am mostly worried about the huge amount of spaces before each line, and also the fact that the first join is not placed after a new line. Everything looks so weird and I've gone through all the settings with no luck.

Thanks in advance!

4
3 comments

It's broken for me too, big times! There are many missing settings compared to 2018.1 (for example the General tab is gone).

1

Hi.

Please raise a ticket at https://youtrack.jetbrains.com/issues/DBE

0

Thank you Petr, I just did: https://youtrack.jetbrains.com/issue/DBE-6829. I was not sure if this was a bug :)

1

Please sign in to leave a comment.