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/
PostgreSQL License
1.66k stars 100 forks source link

Possible conflict between --wrap-after and --comma-break #318

Closed dbachhh closed 1 year ago

dbachhh commented 1 year ago

Hi, thank you so much for this piece of software. I was playing around with the options and there is a strange case where comma-break doesn't work:

pg_format -i test.sql --comma-break --wrap-after 80

INSERT INTO (
    field_one,
    field_two,
    field_three)
VALUES (
    1,
    2,
    3);

pg_format -i test.sql --comma-break

INSERT INTO (
    field_one, field_two, field_three)
VALUES (
    1, 2, 3);

So it seems like wrap-after is in conflict comma-break formatting, would like to ask if this the intended behavior ?

darold commented 1 year ago

Yes, this is attended. The --wrap-after option is used to force a break when a comma is encountered around the 80th characters, in this case the --comma-break option can not be used, it has no more sens.