I noticed a handful of issues and I wanted to bring them to attention. I'm unfamiliar with Perl so it'd be a bit much to make the fixes myself - I'd be happy to be a tester if needed.
Command line arguments specified:
--keep-newline
--nogrouping (I don't think this actually has any affect, but I used it so I'm including it in reproduction notes)
Issues noticed:
Newlines are not preserved if they occur before a comment
Inconsistent indentation of INSERT statements
Without a preceeding comment, they are one level less indented than desired..
With a preceding comment, they are indented as desiredd
Multi-row insert statements have an alignment issue with the first row and subsequent rows because the VALUES keyword is included on the first row. (This issue is minor)
(Not included in example below) - The lines following a CROSS JOIN are indented one level less than desired. I believe this may be due to the lack of the ON keyword.
I'm unsure how much of this is related to the use of an anonymous code block, but that does help highlight the indentation issue - it may also occur elsewhere. I have confirmed these issues still occur in the latest version of Beautify.pm as of the time of this submission.
I've prepared some SQL below to demonstrate this
Expected output (also the input):
DO $$
DECLARE
_variable int := 42;
BEGIN
-- This is a comment
CREATE TEMP TABLE IF NOT EXISTS tempy_mc_tempface (
test text
);
TRUNCATE TABLE tempy_mc_tempface;
INSERT INTO tempy_mc_tempface
VALUES
('tempy'),
('mc'),
('tempface');
-- Another Comment
INSERT INTO tempy_mc_tempface
VALUES ('another');
END
$$;
Actual output:
DO $$
DECLARE
_variable int := 42;
BEGIN
-- This is a comment
CREATE TEMP TABLE IF NOT EXISTS tempy_mc_tempface (
test text
);
TRUNCATE TABLE tempy_mc_tempface;
INSERT INTO tempy_mc_tempface
VALUES ('tempy'),
('mc'),
('tempface');
-- Another Comment
INSERT INTO tempy_mc_tempface
VALUES ('another');
END
$$;
I noticed a handful of issues and I wanted to bring them to attention. I'm unfamiliar with Perl so it'd be a bit much to make the fixes myself - I'd be happy to be a tester if needed.
Command line arguments specified:
Issues noticed:
I'm unsure how much of this is related to the use of an anonymous code block, but that does help highlight the indentation issue - it may also occur elsewhere. I have confirmed these issues still occur in the latest version of Beautify.pm as of the time of this submission.
I've prepared some SQL below to demonstrate this
Expected output (also the input):
Actual output: