Skip to content

[FORMATTING] Inner SQL don't format when using $$ #626

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

Closed
lucca65 opened this issue Aug 2, 2023 · 1 comment
Closed

[FORMATTING] Inner SQL don't format when using $$ #626

lucca65 opened this issue Aug 2, 2023 · 1 comment
Labels

Comments

@lucca65
Copy link

lucca65 commented Aug 2, 2023

Input data

Which SQL and options did you provide as input?

SELECT
  is_empty (
    $$ update tasks set score = 4 where score = 5 returning 1 $$
  , 'admins cannot update tasks in organizations that they are not admins'
  );

Expected Output

SELECT
  is_empty (
    $$ UPDATE tasks SET score = 4 WHERE score = 5 RETURNING 1 $$
  , 'admins cannot update tasks in organizations that they are not admins'
  );

Actual Output

SELECT
  is_empty (
    $$ update tasks set score = 4 where score = 5 returning 1 $$
  , 'admins cannot update tasks in organizations that they are not admins'
  );

Usage

  • How are you calling / using the library?
    • I'm using it with Prettier.
    • This is my config:
language: 'postgresql',
keywordCase: 'upper',
expressionWidth: 50,
commaPosition: 'before',
  • What SQL language(s) does this apply to?
    • postgresql
  • Which SQL Formatter version are you using?
@lucca65 lucca65 added the bug label Aug 2, 2023
@lucca65 lucca65 changed the title [FORMATTING] Issue Title Here [FORMATTING] Inner SQL don't format when using $$ Aug 2, 2023
@nene
Copy link
Collaborator

nene commented Aug 3, 2023

This is by design. The formatter has no way of knowing that this particular dollar-quoted string is SQL and should also be formatted.

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