sql-formatter-org / sql-formatter-org/sql-formatter
postgresql: better handle DISTINCT clause
Open
Nobody has claimed this yet.
bug
postgresql
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
At present sql-formatter produces:
SELECT
DISTINCT ON (c1, c2) c1,
c2
FROM
t1;
But we expect:
SELECT
DISTINCT ON (c1, c2)
c1,
c2
FROM
t1;
-- or
SELECT DISTINCT ON (c1, c2)
c1,
c2
FROM
t1;
Contributor guide
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 PostgreSQL query in sql-formatter and trace how its DISTINCT clause is formatted. Compare the result with the requested examples, then verify that DISTINCT ON appears at the expected indentation without changing the surrounding SELECT list formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, typescript
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100