indentation of FROM and WHERE in longer subquery doesn't match
Open
Nobody has claimed this yet.
- Dominant language
- PLpgSQL
- Stars
- 2k
- Forks
- 121
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 7
Description
Much like https://github.com/darold/pgFormatter/issues/240.
SELECT
SELECT
sum(amount)
FROM
payments + /* keep this comment to avoid crash */ (
SELECT
sum(amount)
FROM payments
WHERE
owner_id IN (
SELECT
id
FROM invoices)) + coalesce((
SELECT
sum(amount)
FROM payments
WHERE
TYPE IN ('xxx')), 0);
$ pg_format -v
pg_format version 5.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the formatting issue with pg_format version 5.0 using the SQL example in the report, then inspect the formatter's handling of nested subqueries and their FROM and WHERE clauses. Done means the longer subquery is consistently indented without the reported mismatch, while preserving the comment and valid SQL output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, sql
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100