sql-formatter-org / sql-formatter-org/sql-formatter
In SELECT ... INTO, the INTO should be on a separate line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
Describe the Feature
Right now, the INTO is placed at the end of the last SELECT line.
This makes it quite hard to see.
When parsing the commands, I see SELECT but nothing that signals that this will create or modify a table. In fact, when I remove the INTO name, the formatting does not change.
I suggest to place the INTO on a new line to give it more visibility.
Currently:
SELECT
r.*,
nrm.idx INTO parking_driveways
FROM
_parking_roads r
JOIN _parking_node_road_mapping nrm ON r.osm_id = nrm.way_id
JOIN parking_intersections i ON nrm.node_id = i.node_id
WHERE
i.service_degree > 0
AND i.degree <> i.service_degree
AND r.is_service;
Improved:
SELECT
r.*,
nrm.idx
INTO parking_driveways
FROM
_parking_roads r
JOIN _parking_node_road_mapping nrm ON r.osm_id = nrm.way_id
JOIN parking_intersections i ON nrm.node_id = i.node_id
WHERE
i.service_degree > 0
AND i.degree <> i.service_degree
AND r.is_service;
Why do you want this feature?
I consider the INTO even more important than the SELECT but is has a lot less visibility ATM.
Interesting enough the Github code highlighting does not recognize INTO either…
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 locating the SQL formatter entry point and the formatting logic for SELECT ... INTO, then find the existing tests covering multiline SELECT statements. Update the formatting behavior so INTO begins on its own line, and verify the expected output against the example in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100