SQL Parentheses Alignment Option?
I can't seem to find the sql code style option to change a certain reformatting behavior.
The goal formatting is this
SELECT 'a'
FROM (
SELECT 'a'
FROM blah
) AS sub;
But it only seems to want to format like this, with the open & close parentheses aligned.
SELECT 'a'
FROM (
SELECT 'a'
FROM blah
) AS sub;
I tried switch what seems like every option, but I can't seem to find the right one. Would anyone be able to tell me which option to use to get the first result rather than the second?
Please sign in to leave a comment.
It's Code Style | SQL | Query | Section FROM | Looks: Don't change.
I don't see a Query or Section FROM set of options after the Code Style | SQL in either PhpStorm or DataGrip, both 18.1.4. Here is what I'm seeing
Strangely the formatting in the example has the alignment of the parenthesis I want, but this is not what happens when I reformat.
Wow, sorry, I have been checking that in 2018.2 EAP - they have changed the formatter options completely there.
It doesn't really seem to be possible in 2018.1.
https://www.jetbrains.com/phpstorm/eap/
Terrific that they have that in the pipeline, and what a great excuse for me to try out the EAP.
Thanks Eugene
I'm here in 2021 and I have the same problem.
SELECT *
FROM tablename
WHERE id IN (
1,
2,
3
);
becomes
SELECT *
FROM tablename
WHERE id IN (
1,
2,
3
);
None of the SQL formatting as at 2020.3.2 options are sensitive to parentheses in a WHERE statement.
Unfortunately, there is no way to control formatting within the IN operator, please vote & follow:
https://youtrack.jetbrains.com/issue/DBE-12746