Better SQL formatting!
For some major versions IDEA has made steady progress in SQL support.
I find myself using IDEA instead of specialized SQL tools more often and more (at least for simple tasks).
A feature where IDEA is still very weak is re-format of SQL statements and scripts.
I find it surprisingly complex to format SQL consistently and readable - which makes it only more important to support an automatic reformat that gives very good results.
There are a lot of issues in YouTrack for better support of specific formatting features.
I think though that some dedicated work should be spent on improving SQL reformatting in general!
(The best standalone tool I have found so far is SQLinForm. Its options can be a good reference for other tools :-)
What do you think?
Is this important enough to justify the required effort?
Please sign in to leave a comment.
Please wait for the next EAP. SQL formatter has just received its share of attention ;-).
Wow, thanks! A big step forward.
I especially like the case and quote correction settings which make it easier to copy/paste generated code from elsewhere and have it readable. (And unquote even considers keywords correctly :-)
What I am missing (at first sight) are options to have a new line after each master keyword, like after the "from" keyword here:
select
elefant
from
africa
Also some alignment options would be fantastic, like on aliases:
select
count(*) as count,
s.pr as price
or on types in DDL:
create table config (
id int(11) not null auto_increment comment 'Primary Key',
name varchar(200) not null,
value text,
Thanks, I've created http://youtrack.jetbrains.com/issue/IDEA-92018 for this.