-
Notifications
You must be signed in to change notification settings - Fork 101
/
ChangeLog
1307 lines (1158 loc) · 61.7 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Febuary 04 2023 - v5.5
This maintenance release fixes some issues reported by users since the last
month and some improvements.
Improvements:
* Prevent newline in function supporting the FROM keyword like substring().
* Add multi-line formatting on TRUNCATE with a table list. Thanks to GabenGar
for the feature request.
Here is the complete list of changes and acknowledgments:
- Fix not respected --no-space-function behavior with SELECT of function.
Thanks to fenuks for the report.
- Update regression test result for fix on double quoted alias name. Thanks
to Christoph Berg for the report.
- Fix potential exception on uninitialized variable. Thanks to Nate Smith
for the report.
January 11 2023 - v5.4
This maintenance release fixes issues reported by users since the last five
months with some improvements and new features.
New options and features:
- Add option --no-space-function, when used pgFormatter removes the
space character between a function call and the open parenthesis that
follow. By default pgFormatter adds a space character, for example:
DROP FUNCTION IF EXISTS app_public.hello (a text);
When this option is used the resulting query is formatted as follow:
DROP FUNCTION IF EXISTS app_public.hello(a text);
Available in CGI mode as a checkbox.
- Add command line option --extra-keyword to apply keywords formatting to
a list of additional keywords defined in a file (one keyword per line).
You can also pass a special value 'redshift' instead of a path to a file
to use the keywords defined internally in pgFormatter for this database.
This was historically possible through the -r | --redshift option that
is now obsolete and will be removed in the future. Thanks to Thom Brown
for the feature request.
Here is the complete list of changes and acknowledgments:
- Add option --no-space-function. Thanks to Aaron Merryman for the feature
request.
- Fix particular case of alias with double quote. Thanks to Carl Jackson
for the report.
- Fix some lines involuntary turned to comment. Thanks to Daniel Kukula
for the report.
- Fix CREATE DOMAIN formatting. Thanks to Daniel Kukula for the report.
- Add formatting of code from SQL function.
- Fix wrong indentation in ORDER BY clause. Thanks to Thom Brown for
the report.
- Fix CREATE TRIGGER formatting when there is a OR REPLACE clause. Thanks
to hexcowboy for the report.
- Fix documentation by using variable based installation instruction.
Thanks to Lav Patel for the patch.
- Add the possibility to format in place multiple files. Thanks to Benjamin
Yolken for the report.
August 07 2022 - v5.3
This maintenance release fixes issues reported by users since the last six
months. Here is the complete list of changes and acknowledgments:
- Remove some useless parenthesis in DML statement. Thanks to Marc Cousin
for the request.
- Fix -o | --output that was always forced to stdout.
Thanks to Linekio and Joraao Bernardo for the report.
- Fix unsupported json operator ?|. Thanks to Jack Thibaut for the report.
- Fix formatting of create table with option and tablespace. Thanks to
jonyscathe for the report.
- Fix wrong wrapping in create table when --nocomment was used. Thanks to
Alexander Haase for the report.
- Fix nested CREATE SCHEMA formatting. Thanks to GabenGar for the report.
- Fix invalid multi-line string constant formatting. Thanks to zaneduffield
for the report.
- Force multiple INSERT values to be on separate lines. Previous behavior
was to keep all values on the same line. Thanks to Damien-B for the report.
- Add missing ELSIF keyword. Thanks to ideev for the report.
- Fix bad indentation when INDEX is present in target list. Thanks to Marc
Cousin for the report.
December 03 2021 - v5.2
This maintenance release fixes issues reported by users since the last six
months with some improvements and new features.
New options and features:
* Allow to pass multiple files when using --inplace. Thanks to mieszko4
for the patch.
* Add a button to copy formatted text to clipboard in the CGI interface.
Thanks to Yan Sheng for the feature request.
Here is the complete list of changes and acknowledgments:
- Fix bad formatting of materialized view ddl with parameters. Thanks to
Wilson Lin for the report.
- Fix/unicode and --inplace argument causing an error. Thanks to mieszko4
for the patch.
- Fix anonymizing disabled in last version. Thanks to Nikolas Poniros for
the report.
- Correctly format casts to quoted types. Thanks to Adam Vartanian for the
patch.
September 28 2021 - v5.1
This maintenance release fixes issues reported by users since the last six
months with some improvements and new features.
New options and features:
* Alternate format type (option -t) now keep enumeration in GROUP BY
clause on a single line.
* Add new option -k or --keep-newline to preserve empty line in plpgsql
code.
* Look for .pg_format configuration file in local directory first then
in the $HOME directory.
- Force UTF8 encoding for all I/O to solve unicode character in object
name parsing issues.
Here is the complete list of changes and acknowledgments:
- Fix typo in documentation with use of echo instead of cat. Thanks to
Сергей Бурладян for the patch.
- Fix space added after negative sign of numbers. Thanks to Carlos Hanson
for the report.
- Formatting words with CREATE prefix or DROP suffix raises a deadly
warning. Thanks to Martin Jan Kohler for the patch.
- Fix indentation in CASE clause. Thanks to jonyscathe for the report.
- Force UTF8 encoding for all I/O to solve unicode character in object name
parsing issues. Thanks to Monson Shao for the report.
- Fix formatting of the BETWEEN clause. Thanks to Monson Shao for the report.
- Look for .pg_format configuration file in local directory first then in the
$HOME directory. Thanks to Peter Lithammer for the suggestion.
- Add option -k or --keep-newline to preserve empty line in plpgsql code.
This doesn't work with comments for the moment. Thanks to Andrey Larionov
for the feature request.
- Fix "Unmatched ) in regex;" error. Thanks to Hew Wolff for the report.
- Fix an other use of uninitialized value in substitution iterator. Thanks to
Christophe Courtois for the report.
- Fix false positives for TYPE keyword and fix %TYPE and %ROWTYPE. Thanks to
Hew Wolff for the report
- Option -t (alternate format type) now keep enumeration in GROUP BY clause
on a single line. Thanks to MeadMaker pfassina for the feature request.
- Remove temporary debug code
- Fix indentation of FROM and WHERE in subquery. Thanks to Hew Wolff and
Sergey Shepelev for the report.
- Fix indentation before RETURNS when it is a RETURNS NULL ON clause.
- Fix seadly warning: Filehandle STDIN reopened as $[...] only for output.
Thanks to Andrew Dunstan for the report.
- Fix formatting of multi-line comment. Thanks to Jacob Beard for the report.
- Fix use of uninitialized value in pattern match. Thanks to arlt for the
report.
February 11 2021 - v5.0
This major release fixes issues reported by users since the last six
months with some improvements and new features.
New options and features:
* Add new option -M | --multiline to enable multi-line search
with placeholder regexp specified at command line with -p
or --placeholder.
* Fix improper handling of constants between quotes in all kind
of queries and especially in function body. They were sometime
corrupted by extra space before of after single quotes or some
words was identified as keywords and turned upper case.
* Add keywords ALWAYS, DISABLE, ENABLE, LEVEL and STORED.
* Improve formatting of CREATE POLICY which doesn't the need anymore
that alternate formatting (-t) be enabled.
* More fix of false positive keywords detection following their place.
* Add REGCLASS, REGCONFIG, REGDICTIONARY, REGNAMESPACE, REGOPER,
REGOPERATOR, REGPROC, REGPROCEDURE, REGROLE, REGTYPE, to list of
data types.
Here is the complete list of changes and acknowledgments:
- Fix false positive detection of keyword following their place.
Thanks to allprecisely for the report.
- Add quick regression test for constant handling.
- Fix formatting for RAISE, CAST and EXCEPTION.
- Fix case of NEW/OLD in triggers code
- Fix improper handling of columns and tables aliases between
double quotes.
- Don't assume HOME variable exists in Makefile.PL. Thanks to
Samyak Bakliwal for the patch.
- Add new option -M | --multiline to enable multi-line search
with placeholder regexp specified at command line with -p
or --placeholder. Thanks to Taro Sato for the feature request.
- Fix generated columns formatting. Thanks to Oliver Ni for the
report.
- Include regression test to not wrap URL hint and update the
documentation.
- Adding example for regular expression preserving the URL and
to prevent it from being wrapped. Thanks to Clement Aubert for
the patch.
- Improve RLS policy formatting when alternate format is enabled.
Thanks to madflow for the report.
- Change download URL in favor of GitHub releases.
- Fix detection of identifier with quoted schema and/or table.
Thanks to Robert for the report.
- Fix formatting of numbers with signed exponents. Thanks to Jakob
Egger for the report.
- Fix HTML footer in CGI mode.
- Fix formatting of CREATE TABLE using a CTE. Thanks to prichardson211
for the report.
- Replace deprecated TG_RELNAME with TG_TABLE_NAME. Thanks to Andreas
Karlsson fot the patch.
- Fix regression in COPY formatting. Thanks to Paul Melnikow for the
report.
- Fix CTE formatting with NOT MATERIALIZED clause. Thanks to Sergey
Shepelev for the report.
- Update regression tests with the addition of oid types and fix
for C functions formatting.
- Fix error format string for extra-function and 2 typos. Thanks to
Sven Klemm for the patch.
- Fix formatting for C functions with obj_file and link_symbol.
Thanks to Sven Klemm for the patch.
- Fix typo in CGI text. Thanks to Justin Hawkins for the report.
- Add oid types to list of data types. Thanks to Sven Klemm for
the patch.
August 31 2020 - v4.4
This is a maintenance release to fix issues reported by users since
the last six months. As usual there is also some improvements and
new features.
New options and features:
* Add command line option --extra-function to apply formatting to
a user defined list of function like with PG internal functions.
* Add --no-rcfile / -X option to avoid loading user configuration
file. Thanks to Norbert Buchmueller for the patch.
* Add -i | --inplace command line option to override an input file
with the resulting formatted content.
* Add new command line option -L, --no-extra-line. By default an
empty line is added after the end of a statement when it is
terminated by a semi-colon except in a plpgsql code block.
If the extra empty line at end of the output is useless, you can
remove it by adding this option to the command line.
* Add option -C, --wrap-comment to enable comment wrapping. Used
to wrap comments at the length defined by -w or --wrap-limit
whatever is the part of the comment. Indent is not included in
the character count.
* Add Dockerfile that builds image with pgformatter.
Here is the complete list of changes and acknowledgments:
- Fix unwanted extra new line after comment.
- Add Dockerfile that builds image with pgformatter. The tool can
then be run as
cat file.sql | docker run --rm -a stdin -a stdout -i darold.net/pgformatter -
where darold.net/pgformatter is name of the image build using
docker build -t darold.net/pgformatter .
Thanks to Manish Tomar for the patch.
- Add new option --extra-function and associated configuration
directive extra-function. pgFormatter applies some formatting to
the PostgreSQL internal functions call but it can not detect user
defined function. It is possible to defined a list of functions
into a file (one name per line) and give it to pgFormatter through
the --extra-function option that will be formatter as PostgreSQL
internal functions. Thanks to Sven Klemm for the feature request.
- Fix unwanted space inserting inside triple single quotes. Thanks
to Caleb Cushing for the report.
- Add -i | --inplace command line option to override an input file
with the resulting formatted content. Thanks to Francilio Araujo
for the feature request.
- Fix an other uncaught exception and formatting issue to insert
statement. Thanks to allprecisely for the report.
- Add new command line option -L, --no-extra-line. By default an
empty line is always added after the end of a statement when it
is terminated by a ; except in a plpgsql code block. If the extra
empty line at end of the output is useless, you can remove it by
using this option. Thanks to Wael Nasreddine for the feature
request and David Johnston for the patch review.
- Fix new uncaught exception with non semi-colon terminated query.
Thanks to allprecisely for the report.
- Order options list in alphabetic order for usage output.
- Use env PG_FORMAT to check that pg_format compiles ok and improve
regression test. Thank to Norbert Buchmueller for the patches.
- Do not read configuration file if the filename is empty. Thank to
Norbert Buchmueller for the patch.
- Add support of pg_trgm operators. Thanks to Carlo Hyvonen for the
report.
- Fix some regexp with or condition.
- Add word boundaries when AS statements require a newline. Thanks
to Vikrum Nijjar for the patch.
- Add possible use of configuration file. Thanks to Duncan Holm for
the feature request.
- Fix case of time zone data type.
- Add new regression test about data type and function case.
- Fix upper case of column name with the same name as a data type.
Thanks to Jacques Dafflon for the report.
- Fix upper case of double precision data type.
- Fix upper case when object name is also a built-in function.
Thanks to Jacques Dafflon for the report.
- Fix special handling of MySQL code delimiter // or $$. Thanks to
Clement Aubert for the test cases.
- Fix integrity of comments broken with last commits. Thanks to mjfs
for the report and tests cases.
- Fix special case of DELIMITER followed by a ;. Thanks to Clement
Aubert for the report.
- Fix newline after a comment inside a function parameters. Thanks
to mfs for the report.
- Complete previous patch when --comma-start is used.
- Change position of a comma when it appears after a comment if
option -b | --comma-start is not use.
- Fix error related to modification of non-creatable array value.
Thanks to John Walsh and Mark Fletcher for the report.
- Add hints on using stdin as input to pg_format. Thanks to Vignesh
Raja for the suggestion.
- Fix several incorrect case conversion for data types. Thanks to
Jacques Dafflon for the report.
- Fix wrong case of function detection in a CREATE TABLE statement
when the name of the table is also the name of a function. Thanks
to Jacques Dafflon for the report.
- Fix uncaught exception. Thanks to George MacKerron for the report.
- Fix connection limit formatting in CREATE ROLE. Thanks to Nathan
Cahill for the report.
- Fix unwanted code formatting in format() function. Thanks to Ervin
Weber for the report.
- Fix indentation in identity column GENENERATED BY clause. Thanks
to Peter Boromissza for the report.
Mars 29 2020 - v4.3
This is a maintenance release to fix issues reported by users since
the last two months. As usual there is also some improvements and
more formatting supported.
New options:
* Add command line option -r | --redshift to add RedShift specific
keywords to the list of SQL keywords to format.
* Add command line option -N | --numbering to include statement
numbering. All formatted statements or block of code are prefixed
by a line with comment: /* Statement # n */.
Also available in CGI mode as a select box option.
Backward compatibility:
* Keep simple quote as function code delimiter, previous behavior
was to replace them by $$ and replace all double simple quote in
the code by a single one. Now they are kept unchanged.
* Restore formatting of --comma-break option with INSERT statement, a
regression was introduced in version 4.2.
Here is the complete list of changes and acknowledgments:
- Better indentation of sub queries inside a "WITH" clause. Thanks
to Cyril Chaboisseau for the report.
- Fix WHERE tuple indentation. Thanks to Sergey Shepelev for the
report.
- Add more information to the -r | --redshift option
- Document --redshift option. Thanks to Elliott Shugerman for the
patch.
- Fix indentation of join clause in CTE. Thanks to ejabu for the
report.
- Format (NEW|OLD).colname keyword in trigger function.
- Fix formatting of scripts using psql command. Thanks to phiresky
for the report.
- Fix several cases of string literal corrupted by the formatting
- Fix formatting of B'...' string.
- Fix case where column aliases was lost. Thanks to YunheXu for
the report.
- Add AWS RedShift keywords to formatting.
- Fix unwanted formatting of multi-line text.
- Prevent newline between parameters of custom functions.
- Remove newline with an ORDER BY and USING clause in a function.
- Prevent newline in parameters of PREPARE and EXECUTE statement.
- Remove newline in columns list in ANALYZE statement.
- Add several builtin functions to the list of PostgreSQL functions.
- Prevent newline in FOREIGN SERVER OPTIONS list.
- Remove newline inside IN (...) values
- Fix data type formatting after IN, OUT and INOUT in functions
parameters. Thanks to prichardson211 for the report.
- Add new command line option to add statement numbering. Thanks to
Gajus Kuizinas for the feature request.
- Fix wrong indentation of WHERE clause after a JOIN in a CTE.
Thanks to Ejabu for the report.
- Update regression test for --comma-break
- Fix a case sensitive condition and update regression tests.
- Restore formatting of --comma-break option with INSERT statement.
Thanks to Brady Holt for the report.
- Add WITHOUT in the list of keywords and fix formatting of CAST
keyword that was formatted as a function.
- Apply data type formatting after RETURNS and CAST AS clauses.
- Fix formatting of DO ALSO rules.
January 26 2020 - v4.2
This is a maintenance release to fix issues reported by users since
the last three months. As usual there is also some improvements and
more formatting supported.
New option:
* -U | --type-case N : Change the case of the data type name. Default is
lowercase: 1. Values: 0=>unchanged, 1=>lowercase,
2=>uppercase, 3=>capitalize.
also avalaible in CGI mode as a select box option.
Here is the complete list of changes and acknowledgments:
- Fix indentation if CASE clause when there is ; in statement.
Thanks to Sergey Shepelev for the report.
- Fix indentation of ORDER BY in OVER() clause. Thanks to Giorgi
Modebadze for the report.
- Keep CREATE STATISTICS statement on a single line.
- Restore CREATE INDEX on a single line (no newline before using)
to conform to pg_dump output.
- Fix indentation when IF NOT EXISTS clause is present.
- Add execution of regression tests through call to: make test.
Thanks to Christoph Berg for the feature request.
- Fix uninitialized variable error.
- Fix identation of VALUES clause for INSERT statement in function
code. Thanks to Sergey Shepelev for the report.
- Fix indentation between comment and closed parenthesis before a
column alias. Thanks to Laszlo Zsolt Nagy for the report.
- Fix indentation of a FOR UPDATE clause in plpgsql function and
after a LIMIT clause. Thanks to Sergey Shepelev.
- Remove extra newline on inline comment. Thanks to prichardson211
for the report.
- Fix indentation of VALUES in some cases of INSERT statements
- Fix wrong current statement assignment with comment keywword.
- Fix invalid indentation of INSERT into function.
- Dump array values in _dump_var() function.
- Add RAISE to keywords.
- Fix indentation in function with nested BEGIN/END blocks. Thanks
to prichardson211 for the reports.
- Fix other bad formatting in CREATE TYPE statements.
- Indent AS followed by code delimiter in CREATE PROCEDURE statement
just like with CREATE FUNCTION.
- Fix indentation after a function/procedure with single quote as
delimiter.
- Prevent newline between open and close parenthesis in create
function clause when there is no parameters.
- Apply same behavior than previous commit for colon followed by the
variable name in double quotes
- Fix formatting of psql variable used in sql file. Thanks to Girish
Pasupathy for the report.
- Add detection of cast in token for keyword and function formatting
Do not treat TRUE/FALSE as keyword when used a column aliases.
- Fix formatting with casts type after case when using ::. Thanks to
Giorgi Modebadze for the report.
- Fix wrong detection as keyword or column name of tokens COMMENT,
INDEX and CONSTRAINT.
- Add debug information for SQL keyword detection.
- Fix new line in FK constrains between ON and UPDATE.
- Remove newline between UPDATE and the relation name, they appears
now on the same line.
- Fix formatting of ON CONFLICT DO clause. Thanks to prichardson211
for the report.
- Fix formatting of PREPARE ... AS UPDATE
- Replace double quote in functions that has single quote as quote
separator as we replace it by $$.
- Fix wrong formatting with CREATE TABLE in EXPLAIN statement.
- Add newline between AS and WITH keywords. Thanks to Andriy Diulin
for the report.
- Fix indent of RETURNS TABLE clause. Thanks to Ziyaddin Sadigov for
the report.
- Fix formatting of trigger with INSTEAD OF.
- Fix indentation of SELECT inside INSERT statement. Thanks to
Laszlo Zsolt Nagy for the report.
- Fix case where formatting adds a newline before ASC or DESC.
Thanks to Giorgi Modebadze for the report.
- Fix formatting in CREATE TABLE statement with no indent after
first foreign key.
- Fix parsing of function with internal language that was breaking
formatting of subsequent statements.
- Fix formatting of CONSTRAINT TRIGGER.
- Add more debug capabilities.
- Fix wrap in compound FOREIGN KEY. Thanks to Victor Andree for the
report.
- Fix exception when the statement does not end with a semi colon.
Thanks to Ralph R. for the report.
- Allow testing installed binary in /usr/bin required for Debian
- package testsuite. Thanks to Christoph Berg for the patch.
- Reflect test result in exit code of regress_test.pl. Thanks to
Christoph Berg for the patch.
September 20 2019 - v4.1
This is a maintenance release to fix issues reported by users since
the last three month. As usual there is also some improvements and
new features.
* Add -T, --tabs option to make pg_format use tabs instead of space
characters. When this option is used spaces number is set to 1
whatever is the value set to -s, --spaces.
* Allow output to override source file.
* Add option -g, --nogrouping and CGI corresponding checkbox. By
default pgFormatter groups all statements when they are in a
transaction:
BEGIN;
INSERT INTO foo VALUES (1, 'text 1');
INSERT INTO foo VALUES (2, 'text 2');
...
COMMIT;
By disabling grouping of statement pgFormatter will always add an extra
newline characters between statements just like outside a transaction:
BEGIN;
INSERT INTO foo VALUES (1, 'text 1');
INSERT INTO foo VALUES (2, 'text 2');
...
COMMIT;
This might add readability to not DML transactions.
- Add more SQL keyword: REFRESH, MATERIALIZED, EVENT and function
xmltable
- Prevent uppercase of keywords when they are used as column names
in a CREATE TABLE statement.
Here is the complete list of changes and acknowledgments:
- Keep COMMENT ON formatting unchanged when using dollar quoting.
Thanks to Jeremy Palmer for the report.
- Allow to disable grouping of statements in transaction. Thanks to
Francisco Puga for the feature request.
- Fix unwanted formatting when know keywords are used in a CREATE
TABLE statement. Thanks to Jeremy Palmer for the report.
- Add -T, --tabs option to make pg_format use tabs instead of space
characters. Thanks to jen-Ya for the feature request.
- Update regression tests.
- Prevent new line between DEFAULT and VALUES in insert statements.
- Fix bad formatting with single quote code separator. The separator
is replaced with $$ when the code is multi-line, otherwise the
code is kept untouched.
- Allow regression test on specific test file passed as parameter.
- Fix format when "with time out" is used. Thanks to jjangga0214
for the report.
- Fix backslashes at end of string constant that produce wrong
results. Thanks to jen-ya for the report.
- Fix regression tests with REFRESH / MATERIALIZED.
- Add REFRESH and MATERIALIZED to the list of SQL keywords. Thanks
to jen-Ya for the report.
- Fix tabs indentions used outside indent and add regression test
for -n and -T options.
- Fixes to documentation. Thanks to zach valenta for the patch.
- Fix not remove comment starting with -- when the -n option is
used. Thanks to Brady Holt for the report.
- Fix error about STDIN reopened as STDOUT introduced in commit
af63e9e. Thanks to Daniel McAuley for the report.
- Fix newline wrongly forced after function parameters in CTE.
- Allow output to override source file. Thanks to Daniel McAuley
for the report.
- Fix formatting when a token start with CALL. Thanks to Ralph R.
for the report.
- Fix newline in geometry type. Thanks to Sven Over for the report.
- Fix incomplete previous patch.
- Fix missing newline in column list after CTE. Thanks to Giorgi
Modebadze for the report.
- Fix OVERLAPS formatting.
- CGI.pm: correct github link text in footer. Thanks to Stephan
Renatus for the patch
- Fix build of pg function hash.
- Fix wrong formatting in CREATE TABLE statement AS WITH clause.
Thanks to ImreSamu for the report.
- Fix broken indent when AS has parameters.
- Suppress newline in COMMENT ON FUNCTION formatting.
- Fix several indentation issues related to CREATE TABLE with
PARTITION and ALTER statements.
- Fix an other case of bad indentation of EXECUTE in triggers and
undefined value on indentation level.
- Fix an other case of newline introduced in REVOKE statement.
- Fix newline before FROM in REVOKE statement
- Add EVENT keyword and add formatting of CREATE EVENT TRIGGER
statement.
- Fix indentation for an insert statement after a create table
statement in the code of a function. Thanks to LaetitiaJV for
the report.
June 2 2019 - v4.0
This major release fixes a huge list of formatting issues which makes
pgFormmater the best tool to format your plpgsql code and sql queries.
pgFormatter is now able to auto-detect user defined functions to
prevent adding new line between parameters.
There's also a huge improvement to the CGI mode which can now apply
directly a formatting option change to current code to format without
having to submit again the content.
Here is the complete list of changes and acknowledgments:
- Change color of "Format my code" button to be more visible.
- Reorder button in CGI mode for ergonomics improvement.
- Allow instant change when modifying option in CGI mode.
Thanks to Julien Rouhaud for the features request.
- Add varying and xmlserialyze to list of functions.
- Add array_position, array_positions and cardinality to function.
- Add more regression test representing PostgreSQL syntax for all
statements.
- Improve formatting of VALUES in FROM clause.
- Fix bad formatting after $$begin and end$$ since the dollar sign
is allowed in object names.
- Remove newline in multidimensional array
- Fix indention after START WITH.
- Fix indentation in TRUNCATE with multiple tables.
- Fix indentation in GENERATED clause.
- Remove newline before WITHIN GROUP and in parameters list.
- Fix indentation in CREATE TYPE and WITH ORDINALITY AS.
- Add decimal to function list to prevent newline inside parameters.
- Add MATCH to PostgreSQL keywords and fix newline after MATCH.
- Add newline before all ALTER, ADD DROP keywords in ALTER COMMAND
unless there is a DEFAULT or NOT NULL clause.
- Fix ALTER OPERATOR and ALTER AGGREGATE statements.
- Fix CREATE AGGREGATE formatting with ORDER BY in parameters.
- Fix indentation of CREATE AGGREGATE statements and add all related
keywords.
- Fix newline in function supporting ORDER BY clause.
- Add percentile_cont() to the list of these functions.
- Fix case where GROUP BY was not well indented after a JOIN with
AND clause.
- Add float8 combine functions.
- Fix detection of function when they are used in cast,
ex: col::numeric(10,3).
- Fix indentation of FETCH in function.
- Fix missing newline between ] and ) in create statement.
- Keep FETCH ... FROM on the same line. Fix cases where COMMIT or
ROLLBACK was not detected.
- Fix newline between FOLLOWING and EXCLUDE in window functions.
- Add hash functions to functions list array.
- Fix some OPERATOR formatting.
- Fix EXCLUDE formatting in constraint and window function call.
- Fix columns/statements no longer get a newline when following a
subquery. Thanks to Steve Whittaker for the report.
- More speed improvement with huge file.
- Improve performances when parsing file thousand of queries. Thanks
to Bruce Momjian for the report.
- Fix newline in function parameters in CREATE TABLE ... AS SELECT
- Fix newline between BEGIN ISOLATION and AS EXECUTE.
- Fix newline in parameter list of execute procedure in trigger.
- Fix bad indention when there is a comment between EXCEPTION and
WHEN keywords.
- Fix missing indentation in DECLARE section of a DO block.
- Remove newline between PASSING BY and REF in xmlexists() function.
- Add query_to_xml and cursor_to_xml to PostgreSQL function list.
- Fix formatting of CREATE TABLE () AS.
- Fix detection of code delimiter in function resulting in infinite
loop. Thanks to Bruce Momjian for the report.
- Fix formatting of CREATE VIEW with colomn names.
- Add COSTS and OFF to pg keywords.
- Fix newline and indentation after insert statements.
- Terminate bloc mode when ROLLBACK is found.
- Fix indention in EXPLAIN option. Thanks to Bruce Momjian for the
report.
- Fix support of CREATE OPERATOR prefixed with schema and unwanted
tokenisation of attributes NEGATOR/COMMUTATOR. Thanks to Bruce
Momjian for the report.
- Fix indentation of CREATE OPERATOR.
- Prevent new line in CHECK clause of a CREATE DOMAIN statement.
- Prevent newline before FROM in a CREATE CONVERSION clause.
- Do not add newline in DROP list.
- Fix newline between CREATE/DROP GROUP.
- Fix infinite loop in detection of function code delimiter. Thanks
to Bruce Momjian for the report.
- Fix extra newline before ; in CREATE/DROP sequence statement.
- Fix indentation of first function parameter with -t option
- Fix bad indenting with CREATE FUNCTION causing following INSERT
to indent. Thanks to Bruce Momjian for the report.
- Fix broken indentation after CREATE TRIGGER statement.
- Fix extra newline between open parenthesis and ORDER BY in WINDOW
clause. Thanks to Bruce Momjian for the report.
- Fix double indention before VALUES in INSERT statement.
- Fix indentation in CREATE RULE statement.
- Remove spaces before/after the WITH arguments if --wrap-after
is used.
- Fix extra indentation in WITH clause before ending parenthesis
when --wrap-after is enabled.
- Fix newline after DISTINCT when wrap after is enabled. Thanks to
Bruce Momjian for the report.
- Fix wrapping of WITH parameters when --wrap-after is enabled.
Thanks to Bruce Momjian for the report.
- Apply --wrap-after behavior to WITH clause. Thanks to Bruce
Momjian for the report.
- Apply --wrap-after behavior to SET clause of UPDATE statement.
Thanks to Bruce Momjian for the report.
- Fix missing new line after FROM when --wrap-after is not set.
- Fix odd wrapping in the WINDOW clause. Thanks to Bruce Momjian
for the report.
- Fix some HTML tags and move place of footer.
- Fix indentation after OVER clause without parenthesis part and
indentation level of WINDOW keyword. Thanks to Bruce Momjian for
the report.
- Avoid new line with empty parenthesis after AS keyword. Thanks
to Bruce Momjian for the report.
- Add newline before WINDOW keyword as it is a top-level clause.
- Fix OVER and WINDOW clause indenting. Thanks to Bruce Momjian
for the report.
- Apply --wrap-after behavior into ORDER BY and GROUP BY clauses.
Thanks to Bruce Momjian for the report.
- Fix indention after DECLARE CURSOR statement. Thanks to Bruce
Momjian for the report.
- Fix another crash with uninitialized variable with constant
starting with --. Thanks to NisSAM for the report.
- Fix crash in windows function with uninitialized variable. Thanks
to Bruce Momjian for the report.
April 21 2019 - v3.4
This release fixes several issues reported by users since the last
six months and adds lot of improvements in code formatting:
* Add -W, --wrap-after option to set number of column after which
lists must be wrapped. Default is to puts every item on its own
line.
* Add 'Wrap after' option to CGI in the indentation section to
support the -W | --wrap_atfer command line option in CGI mode.
* Add -w | --wrap-limit command line option to be able to to wrap
queries at a certain length. This option is not available in CGI
mode.
* Allow uploaded file content-type to be application/octet-stream.
* Allow a single $ sign in object name.
* Major optimization of function detection, speed difference is 10
time faster.
* Better detection of function versus keyword with same name.
* Add WORK, GENERATED and IDENTITY as PostgreSQL keyword.
* Add array_remove and array_replace to the list of PostgreSQL
functions.
* Add detection of code separator after DO keyword if it starts
with a dollar sign.
* Add new option -t | --format-type to try another formatting type
for some statements. At this stage it will just use a multi-line
format in POLICY and PUBLICATION statements. It also introduce
newline in parameter function list.
* Add formatting of CREATE POLICY statements.
* Add information about (Neo)vim plugin and Visual Studio use of
pgFormatter to format PLPGSQL and SQL code.
Here is the complete list of changes and acknowledgments:
- Add regression test for --wrap_after option.
- Fix for sub _indent if $self->{ '_level' } is undefined. Thanks
to NisSAM for the patch.
- Add information about special formatting done by -t, -w and -W.
- Add -W, --wrap-after option to set number of column after which
lists must be wrapped. Default: puts every item on its own line.
This applies to SELECT and FROM list. For example:
SELECT a, b, c, d FROM t_1, t_2, t3 WHERE a = 10 AND b = 10;
is formatted into:
SELECT a, b, c, d
FROM t_1, t_2, t3
WHERE a = 10
AND b = 10;
Note this formatting doesn't fits well with sub queries in list.
Thanks to Bruce Momjian for the feature request.
- Add information about the (Neo)vim plugin used to format code for
many file types and that support pgFormatter to format SQL file
type. Thanks to Anders Riutta for the patch to (Neo)vim.
- Fix incorrect indentation of sub-select in function. Thanks to
Ben Hutton for the report.
- Fix indentation error on case statements in CTE. Thanks to Brent
Anderson for the report.
- Reset ->{'_level'} before call to new beautify request. Thanks to
NisSAM for the report.
- Fix indent into BEGIN WORK|TRANSACTION and remove extra new line
between statement in BEGIN blocs. Thanks to Bruce Momjian for the
report.
- Add -w | --wrap-limit command line option to be able to to wrap
queries at a certain length. Note that this could break the code
formatting effort of pgFormatter but be useful in some case.
- Update copyright year.
- Allow a single $ sign in object name otherwise it must be quoted.
Thanks to NisSAM for the report.
- Fix extra newline between DELETE SET NULL, add case to regression
tests. Thanks to Dmitry Chekanov for the report.
- Major optimization of function detection, difference is 10 time
faster. Thanks to NisSAM for the patch.
- Fix formatting of first level of AND / OR
- Fix unexpected extra indentation in CASE statement. Thanks to
jostem for the report.
- Fix newline between RAISE and EXCEPTION and extra indentation
after IF statements.
- Better detection of function versus keyword when they have the
same name. Thanks to Huan Ruan for the report.
- Fix non breaking columns out into newlines in the next CTE. Thanks
to Collin Meyers for the report.
- Add extra newline before a comment /* */ when the last token is ;
for better reading. Thanks to Shon Frazier for the feature request
- Add GENERATED and IDENTITY PostgreSQL keyword and remove newline
character after GENERATED BY. Thanks to madflow for the report.
- Allow uploaded file content-type to be application/octet-stream.
- Add a test on uploaded file to be text file (-T).
- Add information about Perl CGI module requirement. Thanks to Huan
Ruan for the report.
- Add array_remove() and array_replace() to the list of PostgreSQL
functions.
- Fix bad indentation after IF EXISTS clause. Thanks to jostem for
the report.
- Add detection of code separator after DO keyword if it starts with
a dollar sign.
- Using -t (try another format type) puts arguments for functions
on multiple lines for readability. Thanks to Dan Lynch for the
feature request.
- Fix typo, thank to David Lynch for the report.
- Update documentation about the -t option and add link to a Visual
Studio extension to format PostgreSQL SQL and PLPGSQL using
pgFormatter. Thanks to Brady Holt for the extension.
- Add new option: -t | --format-type to try another formatting type
for some statements. At this stage it will just use a multi-line
format in POLICY and PUBLICATION statements. Thanks to Dan Lynch
for the feature request.
- Fix formatting of EXCLUDE/USING clause in constraint/indexes.
Thanks to Dan Lynch for the report.
- Improve trigger formatting. Thanks to Dan Lynch for the report.
- Fix newline inserted after a semicolon in comment statements.
Thanks to Dan Lynch for the report.
- Add formatting of CREATE POLICY statements. Thanks to Dan Lynch
for the report.
- Preserve indentation at end of a create table statement when it
called inside a block. Thanks to visciang for the report.
- Fix formatting of OVER clause.
- Fix missing PARTITION keyword outside main table.
- Fix typo in REMAINDER keyword and move OF keyword to PG list.
November 20 2018 - v3.3
This minor release fixes several issues reported by users since last
release, adds and improves some code formatting:
* Add formatting of GROUPING and ROLLUP clause.
* Replace concat operator from some SGBD with operator ||.
* Add formatting of FILTER and WITHIN GROUP clause.
* Fix several wrong formatting with comment.
* Improve arrays formatting.
* Treat DISTINCT as a modifier of the whole select clause.
* Fix formatting of ON UPDATE/DELETE in create table statements.
* Add DETACH,ATTACH,LIST,HASH,MODULUS and REMINDER to keywords list.
* Add formatting of CREATE PARTITION STATEMENT.
Here is the complete list of changes and acknowledgments:
- Add extra newline after a comment when it is not in a block or a
statement. Thanks to Aaron Reisman for the report.
- Fix inline comments that was wrongly moved after a new line in
some case.
- Fix case where comments that was not moved to next line.
- Trim trailing space in comment. Thanks to Aaron Reisman for the
report.
- Add formatting of FILTER clause. Thanks to Leonardo Rochael
Almeida for the report.
- Update regression test expected on queries using ARRAY[...].
- Remove newline after comma in ARRAY[...] definition.
- Remove space before and after array braket. Thanks to Peter
Boromissza for the report.
- Add FILTER keyword and some missing aggregate functions. Thanks
to Leonardo Rochael Almeida for the report.
- Fix formatting of ON UPDATE/DELETE in create table statements.
Thanks to Peter Boromissza for the report.
- Update regression tests with last changes.
- Treat DISTINCT as a modifier of the whole select clause not only
the fisrt column. Thanks to report of Leonardo Rochael Almeida.
- Fix some typo in documentation. Thanks to 0xflotus for the patch.
October 08 2018 - v3.2
This minor release adds support to PostgreSQL v11.0 new keywords
and fixes several issues reported by users since last release.
* Add new PostgreSQL v11 keywords CALL, GROUPS, INCLUDE, OTHERS,
PROCEDURES, ROUTINE, ROUTINES, TIES.
* Add formatting of CREATE PUBLICATION.
* Add formatting of CREATE PROCEDURE code.
* Add formatting of ALTER PROCEDURE/ROUTINE, all on a single line.
* Add an indentation before VALUES of INSERT statements.
Here is the complete list of changes and acknowledgments:
- Fix weird formatting on UNIQUE and PRIMARY KEY constraints in
CREATE TABLE statements. Thanks to Aaron Reisman for the report.
- Add operator for name convention, ":=" was changed to "=>".
Thanks to snailshell-321 for the report.
- Fix missing formatting in SQL function with a single SELECT.
- Remove any new line in CALL statement.
- Never add newline after comma in ALTER statements.
- Prevent new line between ROW LEVEL SECURITY. Thanks to madflow
for the report.
- Update samples with last formatting changes.
September 12 2018 - v3.1
This minor release fixes several issues reported by users since six
months. This release also adds some improvements in code formatting.
* Function code in other language tha SQL or PLPGSQL is now kept
untouched.
* Make formatting output of function/procedure more compliant with
the pg_dump PostgreSQL format.
* Add information about atom package integration of pgFormatter.
* Add a "Clear code" button to reset text area and preserve
options changes.
* Add a logo to the project and change title and style of the CGI
part.
* Add application/sql content-type support in CGI mode.
Here is the complete list of changes and acknowledgments:
- Add preprocessing to autodetect function language before entering
the tokenizer. If the language is not SQL or PLPGSQL the code is
kept untouched. Thanks to Philip Trauner for the report.
- Fix whatis entry of POD manpage. Thanks to Christoph Berg
for the patch.
- Add more regression tests.
- Remove newline between sub query and ON keyworks in JOIN clause.
Thanks to Christophe Courtois for the report.
- Fix indentation of multiline comments. Thanks to Philip Trauner
for the report.
- Fix missing newline after comma in some select statement,
especially from the online example.
- Fix formatting of query with multiple CTE. Thanks to Christophe
Courtois for the report.
- Fix plv8 syntax. Thanks to Aaron Reisman for the report.
- Fix undefined value crash when formatting query not terminated
by a semi colon. Thanks to David Luzar for the report.
- Add newline and indentation after WITH [RECURSIVE] ... (
- Fix bad indentation on case statements with 0 value. Thanks to
John Dimm for the report.
- Add regression test for sub queries followed by a join.
- Set the code separator for ex19.sql regression test.
- Fix indentation in join when previous instruction is a sub
select. Thanks to Christophe Courtois for the report.
- Fix indentdation of INNER JOINS when a previous JOIN use AND/OR
operator. Thanks to David Vogt for the report.
- Fix indentation problem with sub-select and UNION. Thanks to
Christophe Courtois for the report.
- Fix handling of newline after comma in CGI mode for insert
queries.
- Cleanup some code with comment addition.
- Prevent newline before BETWEEN operator.
- Fix JOIN formatting with AND/OR operator.
- Fix utf8 uncaught exception on CLI mode.
- Remove requirement to Perl v5.14 minimum.
- Avoid backward indentation in multiple JOIN clauses.
- Set default CGI maxlength to 100KB
- Fix unwanted indentation of WHEN in CASE statement.
- Remove use of UTF8 Perl pragma in CGI mode, it is not
recommended and it breaks CGI when not utf8 encoding.
Thanks to Christophe Courtois for the report.
- Fix PREPARE and INSERT|DELETE formatting. Thanks to Tom
Halson for the report.
- Fix formatting of WITH inside CREATE TABLE statement that was
wrongly formatting TIMESTAMP WITH TIME ZONE. Thanks to James
Bourne for the report.
- Fix uninitialized maxlength. Thanks to Steve Wainstead for
the report.
- Reactivate -m | --maxlength in CLI mode that was removed in
version 2.0. Thanks to Steve Wainstead for the report.
Febuary 28 2018 - v3.0
This major release fixes some issues reported by users during the
last six months and adds several new features.
* Add colorization of comments.
* Add detection and colorization of user defined function in the SQL
code. Until now only PostgreSQL internal function was highlighted.
* Add new option -B | --comma-break and in CGI the checkbox
"New-line after comma (insert)" to force a newline after each
comma in INSERT statements, columns and values parts.
* Add command line option: -F | --format to be able to change the
output format in CLI mode. At now there is two possible format,
text the default or html. More format can be added in the future.
* Add support to all psql meta commands up to v1O.
There is also some improvement in SQL code formatting. Here is the
complete list of changes:
- Add information on how to customize CSS in CGI to change the HTML
style.
- Update documentation and add a pointer to the Node.js wrapper
written by Gajus Kuizinas.
- Remove program extention from $self->{program_name} used as title
of the CGI interface.
- Remove html_highlight_code() method to apply HTML formatting style
at token level instead of full SQL content like before. You just