sql-formatter-org / sql-formatter

A whitespace formatter for different query languages
https://sql-formatter-org.github.io/sql-formatter/
MIT License
2.23k stars 392 forks source link

[FORMATTING] Formatter doesn't like the ~ in SQL statement #744

Closed zjpersc closed 1 month ago

zjpersc commented 1 month ago

Input data

Which SQL and options did you provide as input?

SELECT bar, foo FROM foo_bar WHERE customer_prefix_name ~ '^.*\\d{9}.*$' GROUP BY bar

Expected Output

SELECT
  bar,
  foo
FROM
  foo_bar
WHERE
  ~ customer_prefix_name '^.*\\d{9}.*$'
GROUP BY
  bar

Actual Output

Parse error: Unexpected "~ '^.*\\d{" at line 1 column 57.
This likely happens because you're using the default "sql" dialect.
If possible, please select a more specific dialect (like sqlite, postgresql, etc).

Usage

nene commented 1 month ago

It works fine. Just select "redshift" dialect, not the default "sql" one, like the error message suggests to you. FAQ.

I don't know how to do that in this drodil/backstage-plugin-toolbox, you'll need to figure this out on your own or ask from the developers of that plugin.