Skip to content

fix(postgresql): add options to create statements #851

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

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

jamesarosen
Copy link
Contributor

Many of the CREATE ... statements in the postgres dialect were missing options, especially the OR REPLACE option that is common to many commands.

Fixes #850

Copy link

codesandbox-ci bot commented Mar 25, 2025

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.

'CREATE SEQUENCE',
'CREATE [OR REPLACE] RULE',
'CREATE SCHEMA [AUTHORIZATION]',
'CREATE {TEMPORARY | TEMP | UNLOGGED} SEQUENCE',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right syntax. Please compare with https://www.postgresql.org/docs/17/sql-createsequence.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite. The [ { TEMPORARY | TEMP } | UNLOGGED ] in postgres docs is really equivalent to just: [ TEMPORARY | TEMP | UNLOGGED ].

Many of the `CREATE ...` statements in the postgres dialect were missing
options, especially the `OR REPLACE` option that is common to many
commands.

Fixes #850
@jamesarosen jamesarosen force-pushed the fix-pg-create-options branch from 5b9a36d to cd8cfd7 Compare March 25, 2025 22:42
@nene nene merged commit cd8cfd7 into sql-formatter-org:master Mar 26, 2025
1 check passed
@nene
Copy link
Collaborator

nene commented Mar 26, 2025

Thanks for putting in effort to fix more things than just your immediate problem 👍

@nene
Copy link
Collaborator

nene commented Mar 26, 2025

Released in 15.5.2

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.

2 participants