sql-formatter icon indicating copy to clipboard operation
sql-formatter copied to clipboard

Named placeholders are broken due to whitespace

Open michaelborn opened this issue 2 years ago • 3 comments

Name placeholders like WHERE name = :name are broken and do not replace at all.

Example:

SELECT supplier_name, city FROM suppliers
WHERE supplier_id = :name

this formats as:

SELECT
  supplier_name,
  city
FROM
  suppliers
WHERE
  supplier_id =: name

Notice the =: and the space between the : and name - =: name

You can see this right on the demo page:

https://www.vertical-blank.com/sql-formatter/

michaelborn avatar Apr 21 '22 21:04 michaelborn

Note that positional placeholders are still formatted and replace correctly.

michaelborn avatar Apr 21 '22 21:04 michaelborn