Skip to content

Commit de50c80

Browse files
committed
Fix bad indentation with simple join. Thanks to anttilinno for the report.
1 parent fc2c16d commit de50c80

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

lib/pgFormatter/Beautify.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3615,6 +3615,7 @@ sub beautify {
36153615
)
36163616
{
36173617
if ( !$self->{'_parenthesis_level'}
3618+
&& !$self->{'_has_over_in_join'}
36183619
&& $self->{'_is_in_from'} )
36193620
{
36203621
$self->_set_level(

t/test-files/ex78.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,23 @@ BEGIN
1313
END CASE;
1414
END;
1515
$$;
16+
17+
18+
SELECT
19+
z.zoo_id,
20+
z.log_date,
21+
a.firstname,
22+
a.lastname,
23+
zb.break_start
24+
FROM
25+
zoo z
26+
JOIN animals a ON z.animal_id = a.animal_id
27+
AND z.zoo_id = 9
28+
JOIN zoo_breaks zb ON z.zoo_id = zb.zoo_id
29+
AND Date_trunc('minute', zb.break_start) - Date_trunc('minute', z.opening_time) < '2 hours'::interval
30+
AND zb.automatic = TRUE
31+
WHERE
32+
z.log_date >= '2022-01-01'
33+
ORDER BY
34+
z.worker_id;
35+

t/test-files/expected/ex78.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,21 @@ BEGIN
1616
END;
1717
$$;
1818

19+
SELECT
20+
z.zoo_id,
21+
z.log_date,
22+
a.firstname,
23+
a.lastname,
24+
zb.break_start
25+
FROM
26+
zoo z
27+
JOIN animals a ON z.animal_id = a.animal_id
28+
AND z.zoo_id = 9
29+
JOIN zoo_breaks zb ON z.zoo_id = zb.zoo_id
30+
AND Date_trunc('minute', zb.break_start) - Date_trunc('minute', z.opening_time) < '2 hours'::interval
31+
AND zb.automatic = TRUE
32+
WHERE
33+
z.log_date >= '2022-01-01'
34+
ORDER BY
35+
z.worker_id;
36+

0 commit comments

Comments
 (0)