sql-formatter-org / sql-formatter-org/sql-formatter
[FORMATTING] Parenthesized query starting directly after CTE
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
Input data
Which SQL and options did you provide as input?
WITH a AS (
SELECT * FROM items
)
(SELECT a.x FROM a) UNION (SELECT b.x FROM b);
Expected Output
WITH
a AS (
SELECT
*
FROM
items
)
(
SELECT
a.x
FROM
a
)
UNION
(
SELECT
b.x
FROM
b
);
Actual Output
Parenthesized SELECT a.x FROM a query follows directly after the CTE (and has an extra indent) instead of starting on position 0 of the next line.
WITH
a AS (
SELECT
*
FROM
items
) (
SELECT
a.x
FROM
a
)
UNION
(
SELECT
b.x
FROM
b
);
Usage
- How are you calling / using the library? Demo website
- What SQL language(s) does this apply to? PostgreSQL
- Which SQL Formatter version are you using? 14.0.0
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 with the provided PostgreSQL input in the formatter demo and compare its output with the expected formatting. Trace the formatting path for a parenthesized query immediately following a CTE; the work is done when the parenthesized query starts at column zero and matches the expected output without changing the UNION 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
- 35/100