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

Add primary key, generated column reserved phrases #714

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Add primary key, generated column reserved phrases #714

merged 1 commit into from
Feb 5, 2024

Conversation

karlhorky
Copy link
Contributor

Add reserved phrases for PostgreSQL for primary keys and generated columns

After this change, the formatting results in the common style in the ecosystem:

CREATE TABLE animals (
  id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY
);

Before, the following configuration would result in the mixed lowercase for KEY, GENERATED, ALWAYS, and IDENTITY:

CREATE TABLE animals (
  id integer PRIMARY key generated always AS identity
);

Config (attempt to match style of official PostgreSQL docs):

{
  language: 'postgresql',
  keywordCase: 'upper',
  identifierCase: 'lower',
  dataTypeCase: 'lower',
  functionCase: 'lower',
}

This was caused by the PostgreSQL keywords being removed in:

Copy link

codesandbox-ci bot commented Feb 5, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@nene nene merged commit 3483499 into sql-formatter-org:master Feb 5, 2024
2 checks passed
@nene
Copy link
Collaborator

nene commented Feb 5, 2024

Thanks.

@karlhorky
Copy link
Contributor Author

Glad to help, thanks for the review and merge 🙌

@karlhorky karlhorky deleted the patch-1 branch February 5, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants