The following query:
SELECT
*
FROM
some_table
WHERE
AND (row2 = 'b'
OR row3 = 'c'
OR EXISTS (
SELECT
1
FROM
some_table
WHERE
row4 = 'd')
OR (row4 = 'e'));
Gets formatted by pgFormatter 8d0290b as:
SELECT
*
FROM
some_table
WHERE
row1 = 'a'
AND (row2 = 'b'
OR row3 = 'c'
OR EXISTS (
SELECT
1
FROM
some_table
WHERE
row4 = 'd')
OR (row4 = 'e'));
The final OR (row4 = 'e') gets indented one level further to the right than OR row3 = 'c', even though they are part of the same disjunction.
If the OR EXISTS (SELECT 1 FROM some_table WHERE row4 = 'd') part of the query gets deleted, OR (row4 = 'e') gets moved back one indentation level.
This bug only occurs if the disjunction is inside a parenthesis. If the parenthesis is removed, the indentation works as expected.
The following query:
Gets formatted by pgFormatter 8d0290b as:
The final
OR (row4 = 'e')gets indented one level further to the right thanOR row3 = 'c', even though they are part of the same disjunction.If the
OR EXISTS (SELECT 1 FROM some_table WHERE row4 = 'd')part of the query gets deleted,OR (row4 = 'e')gets moved back one indentation level.This bug only occurs if the disjunction is inside a parenthesis. If the parenthesis is removed, the indentation works as expected.