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.68k stars 101 forks source link

Wrong wrapping in create table #280

Closed alehaa closed 2 years ago

alehaa commented 2 years ago

If there are comments in CREATE TABLE, the column definition following the comment won't be wrapped and placed at the same line as the previous column.

CREATE TABLE IF NOT EXISTS hello
(
  foo char(20) NOT NULL UNIQUE,

  -- A comment
  bar char(25),
  abc integer
);

gets

CREATE TABLE IF NOT EXISTS hello (
  foo char(20) NOT NULL UNIQUE, bar char(25),
  abc integer
);
darold commented 2 years ago

This was happening when --nocomment was used. Commit 3bd6b91 fixes this issue.