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

few issues:

dkuku opened this issue · comments

I tried it with this file and I got some issues:
https://github.com/dkuku/AdventureWorks-for-Postgres/blob/master/install.sql

seems like NULL after bracket is moved to newline

create domain "order_number" varchar(25) null;
create domain "account_number" varchar(15) null;

create domain "flag" boolean not null;
create domain "name_style" integer not null;
create domain "name" varchar(50) null;
create domain "phone" varchar(25) null;

becomes

CREATE DOMAIN "order_number" varchar(25)
NULL;

CREATE DOMAIN "account_number" varchar(15)
NULL;

CREATE DOMAIN "flag" boolean NOT NULL;

CREATE DOMAIN "name_style" integer NOT NULL;

CREATE DOMAIN "name" varchar(50)
NULL;

CREATE DOMAIN "phone" varchar(25)
NULL;

some lines were turned to comment

looks like it does not like ,-- pattern

    org varchar null,-- hierarchyid, will become organization_node
    organization_level int null, -- as organization_node.get_level(),
        org varchar NULL, -- hierarchyid, will become organization_node organization_level int NULL, -- as organization_node.get_level(),

same here:

    doc varchar null,-- hierarchyid, will become document_node
    document_level integer, -- as document_node.get_level(),

        doc varchar NULL, -- hierarchyid, will become document_node document_level integer, -- as document_node.get_level(),
    thumb_nail_photo bytea null,-- varbinary
    thumbnail_photo_file_name varchar(50) null,
    large_photo bytea null,-- varbinary
    large_photo_file_name varchar(50) null,

        thumb_nail_photo bytea NULL, -- varbinary thumbnail_photo_file_name varchar(50) NULL,
        large_photo bytea NULL, -- varbinary large_photo_file_name varchar(50) NULL,

Commits 4e89ea3 and 509f8ce fix this issue.