Skip to content

Spurious empty line reformatting a query using a subselect #334

Description

@lelit

This query:

select c.id, c.value, (select count(*) as cnt from d where d.item_id = id) as "Count", c.whatever
from something as c

is prettified like:

SELECT c.id,
       c.value,

  (SELECT count(*) AS cnt
   FROM d
   WHERE d.item_id = id) AS "Count",
       c.whatever
FROM something AS c

Without the AS "Count" there is no empty line.

Also, wouldn't it be nicer to align the open paren of the subselect to the other columns, or alternatively something like

SELECT 
  c.id,
  c.value,
  (SELECT count(*) AS cnt
   FROM d
   WHERE d.item_id = id) AS "Count",
  c.whatever
FROM something AS c

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions