-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FORMATTING] Confusion between LIMIT keyword and column name #302
Comments
Thanks for reporting. Related to #156 This is currently a general issue with how the formatter distinguishes language keywords from identifiers. For the time being there's no quick fix for this. We're working towards a more general solution, though no idea when we'll finally get there. |
A workaround for the time being is to quote the column name, e.g. |
@nene Yea in our case we insert using Knex.insert() so it builds the query based on the inputs... so wrapping limit in quotes would be messy. By the way the latest v8.1.0 changed the result slightly... INSERT INTO
search (
apples,
limit
, pears,
oranges,
apricots
)
-- etc... to... INSERT INTO
search (
apples,
limit
, pears, --shifted to the left
oranges, --one indent extra to right
apricots
)
-- etc... |
This issue has gone worse in the latest releases. The above SQL will now produce a hard error:
The problem being that we're now expecting see |
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
Actual Output
Usage
calling inside a Jest snapshot-serializer
postgresql
I'm using v8.0.2
The text was updated successfully, but these errors were encountered: