Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad indentation with simple join? #278

Open
anttilinno opened this issue Feb 17, 2022 · 0 comments
Open

Bad indentation with simple join? #278

anttilinno opened this issue Feb 17, 2022 · 0 comments

Comments

@anttilinno
Copy link

Good day,

I will just post an example and if this looks like it could use improvement, I will file an issue correctly. If this is expected behavior, I saved a bit of time 😄

This is formatter output

SELECT
  z.zoo_id,
  z.log_date,
  a.firstname,
  a.lastname,
  zb.break_start
FROM
  zoo z
  JOIN animals a ON z.animal_id = a.animal_id
    AND z.zoo_id = 9
  JOIN zoo_breaks zb ON z.zoo_id = zb.zoo_id
    AND Date_trunc('minute', zb.break_start) - Date_trunc('minute', z.opening_time) < '2 hours'::interval
  AND zb.automatic = TRUE
WHERE
  z.log_date >= '2022-01-01'
ORDER BY
  z.worker_id;

I would assume JOIN conditions are aligned and would like to see output:

SELECT
  z.zoo_id,
  z.log_date,
  a.firstname,
  a.lastname,
  zb.break_start
FROM
  zoo z
  JOIN animals a ON z.animal_id = a.animal_id
    AND z.zoo_id = 9
  JOIN zoo_breaks zb ON z.zoo_id = zb.zoo_id
    AND Date_trunc('minute', zb.break_start) - Date_trunc('minute', z.opening_time) < '2 hours'::interval
    AND zb.automatic = TRUE
WHERE
  z.log_date >= '2022-01-01'
ORDER BY
  z.worker_id;

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant