Skip to content
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

Some identifiers get converted to uppercase with keywordCase:upper #740

Open
krishnagogada opened this issue May 9, 2024 · 3 comments
Open
Labels

Comments

@krishnagogada
Copy link

Input data

Which SQL and options did you provide as input?

create table player_match_details(
  name varchar(150),
  match varchar(150),
  score int
);

Expected Output

CREATE TABLE player_match_details(
  name varchar(150),
  match varchar(150),
  score int
);

Actual Output

CREATE TABLE player_match_details(
  name varchar(150),
  MATCH varchar(150),
  score int
);

Usage

  • How are you calling / using the library?
import { format } from 'sql-formatter';
  • What SQL language(s) does this apply to?
  {
      language: 'sql',
      indent: '',
      uppercase: true,
      linesBetweenQueries: 2
   }
  • Which SQL Formatter version are you using?
    15.3.1
@nene
Copy link
Collaborator

nene commented May 9, 2024

Thanks for reporting. This is similar to #302 and #732.

One one hand this is really a fundamental problem with SQL Formatter that can't be easily fixed. (I could remove MATCH from list of keywords and then we'd have the opposite problem).

On another hand, you would be better off not using the default language:"sql". If possible choose the value that matches the SQL dialect you're actually using, like language: "postgresql". That other dialect might or might not have MATCH in its list of keywords.

FYI, there are no uppercase and indent options in latest SQL Formatter. You're either using some old version or some other tool altogether.

@krishnagogada
Copy link
Author

@nene

Thanks for the reply,
I kept the specific language SQLite, even though I have the issue.
Is there any alternative fix?

@nene
Copy link
Collaborator

nene commented May 15, 2024

An alternative is to use a different formatting library which doesn't have this issue: https://github.com/nene/prettier-plugin-sql-cst

@nene nene changed the title [FORMATTING] column name "match" is converted to uppercase. Identifiers (with same name as some keywords) get converted to uppercase Oct 26, 2024
@nene nene changed the title Identifiers (with same name as some keywords) get converted to uppercase Some identifiers get converted to uppercase with keywordCase:upper Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants