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

CREATE TABLE formatted to single line with quoted schema #311

Closed lsyuan closed 1 year ago

lsyuan commented 1 year ago

When schema name with quote, then the CREATE TABLE will be formatted to single line, however if remove the schema quote then result is just expected. Version: 5.4 Duplicated with https://github.com/darold/pgFormatter/issues/227, seems it appears again in the new version.

Actual Result:

CREATE TABLE "{Tenant_Schema}"."PatientDentalChartHistory" ("Id" uuid NOT NULL, "IsDeleted" bool NOT NULL, "CreateDate" timestamptz NOT NULL, "UpdateDate" timestamptz NOT NULL, "ClinicIdentifier" int8 NOT NULL, CONSTRAINT "PK_PatientDentalChartHistory" PRIMARY KEY ("Id")
);

Expected Result:

CREATE TABLE "{Tenant_Schema}"."PatientDentalChartHistory" (
    "Id" uuid NOT NULL,
    "IsDeleted" bool NOT NULL,
    "CreateDate" timestamptz NOT NULL,
    "UpdateDate" timestamptz NOT NULL,
    "ClinicIdentifier" int8 NOT NULL,
    CONSTRAINT "PK_PatientDentalChartHistory" PRIMARY KEY ("Id")
);

Kindly please take a look with many thanks~

darold commented 1 year ago

Commit c55d3e42 fixes this issue.