Skip to content

[FORMATTING] Inconsistent formatting of PostgreSQL CREATE POLICY commands #928

@peperoli

Description

@peperoli

Input data

Which SQL and options did you provide as input?

CREATE POLICY "Allow users to select their own records" ON public.user_achievements
  FOR SELECT
  TO authenticated
  USING (user_id = auth.uid());

CREATE POLICY "Allow users to insert their own records" ON public.user_achievements
  FOR INSERT
  TO authenticated
  WITH CHECK (user_id = auth.uid());

Actual Output

CREATE POLICY "Allow users to select their own records" ON public.user_achievements FOR
SELECT
  TO authenticated USING (user_id = auth.uid ());

CREATE POLICY "Allow users to insert their own records" ON public.user_achievements FOR INSERT TO authenticated
WITH
  CHECK (user_id = auth.uid ());

Those two similar statements are formatted differently for no apparent reason.

Usage

  • How are you calling / using the library? tested with the demo and prettier-plugin-sql
  • What SQL language(s) does this apply to? PostgreSQL
  • Which SQL Formatter version are you using? (The exact version number.) 15.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions