Skip to content

fix: keep PostgreSQL CREATE POLICY FOR/WITH CHECK together - #968

Open
cnbei wants to merge 1 commit into
sql-formatter-org:masterfrom
cnbei:cursor/pg-create-policy-format-dfe8
Open

fix: keep PostgreSQL CREATE POLICY FOR/WITH CHECK together#968
cnbei wants to merge 1 commit into
sql-formatter-org:masterfrom
cnbei:cursor/pg-create-policy-format-dfe8

Conversation

@cnbei

@cnbei cnbei commented Aug 30, 2026

Copy link
Copy Markdown

Fixes #928

SELECT is a reserved clause and WITH starts a CTE, so FOR SELECT wrapped differently from FOR INSERT, and WITH CHECK split onto two lines. Treat FOR SELECT/INSERT/DELETE as reserved clauses (alongside existing FOR UPDATE) and WITH CHECK as a reserved keyword phrase.

postgresql.test.ts: 462 passed.

Recognize FOR {SELECT|INSERT|DELETE} as clauses and WITH CHECK as a
keyword phrase so SELECT vs INSERT policies no longer wrap differently.

Co-authored-by: cnbei <baymy@foxmail.com>
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.

[FORMATTING] Inconsistent formatting of PostgreSQL CREATE POLICY commands

2 participants