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

Nested CTEs identation problem #290

Open
GabenGar opened this issue Aug 10, 2022 · 0 comments
Open

Nested CTEs identation problem #290

GabenGar opened this issue Aug 10, 2022 · 0 comments

Comments

@GabenGar
Copy link

The structure like this:

WITH hello_world AS (
  WITH hello_another_world AS (
    WITH hello_third_world AS (
      SELECT
      FROM
      WHERE
      ORDER BY
    ), hello_third_world_again AS (
      SELECT
      FROM
      WHERE
      ORDER BY
    )
    SELECT
    FROM
    WHERE
    ORDER BY
  ), hello_another_world_again AS (
    SELECT
    FROM
    WHERE
    ORDER BY
  )
  SELECT
  FROM
  WHERE
  ORDER BY
)
SELECT
FROM
WHERE
ORDER BY

Gets formatted as:

WITH hello_world AS (
  WITH hello_another_world AS (
    WITH hello_third_world AS (
      SELECT
      FROM
      WHERE
      ORDER BY
),
      hello_third_world_again AS (
        SELECT
        FROM
        WHERE
        ORDER BY
)
        SELECT
        FROM
        WHERE
        ORDER BY
),
        hello_another_world_again AS (
          SELECT
          FROM
          WHERE
          ORDER BY
)
          SELECT
          FROM
          WHERE
          ORDER BY
)
        SELECT
        FROM
        WHERE
        ORDER BY

It is kind of a problem since nested CTEs tend to be used in complex queries in which indentation is a hint to the CTEs scope visibility.

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