darold / pgFormatter

A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

line break for each set of values inserted

Damien-B opened this issue · comments

Hi there, I'm using this formatter for pgsql (in vscode via https://github.com/bradymholt/vscode-pgFormatter) and it's great, but there's one condition in which I don't find any satisfactory option, multiple values inserts :

INSERT INTO users ("username", "email", "password")
    VALUES ('user1', 'user1@email.com', 'password1'),
    ('user2', 'user2@email.com', 'password2'),
    ('user3', 'user3@email.com', 'password3'),
    ('user4', 'user4@email.com', 'password4'),
    ('user5', 'user5@email.com', 'password5');

This is the formatting I'd like to see, but the closest I can achieve is setting the comma break option to true (or false). I also tried to use the placeholder option but without success, if anyone has a solution with the current version then I'd love to hear it. Otherwise, it would be wonderful to have a condition on commas preceded by a closing parenthesis. I feel like it's a behaviour everyone would want, but I don't know for sure.

Commit 1321d33 adds this behavior per default. Website updated.