sql-formatter-org / sql-formatter-org/sql-formatter
[FORMATTING] Confusion between LIMIT keyword and column name
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
We have a table with a 'limit' column, when inserting into the table sql-formatter indents characters after the column name.
Input data
Which SQL and options did you provide as input?
options = { language: 'postgresql' };
Expected Output
INSERT INTO
search (
apples,
limit,
pears,
oranges
)
values
(
'__apples',
'__limit',
'__pears',
'__oranges'
);
Actual Output
INSERT INTO
search (
apples,
limit
, pears,
oranges
)
values
(
'__apples',
'__limit',
'__pears',
'__oranges'
);
Usage
- How are you calling / using the library?
calling inside a Jest snapshot-serializer - What SQL language(s) does this apply to?
postgresql - Which SQL Formatter version are you using?
I'm using v8.0.2
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 INSERT example and trace how the formatter handles the limit column in the column list. Add a regression test for the reported input and expected output, then confirm the formatter no longer moves the following comma and column.
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
- Clearly specified
- Newbie friendliness
- 52/100