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

Issue when column name contains escaped enclosing character

Open fabiencelier opened this issue 1 year ago • 5 comments

The query

SqlFormatter.of(Dialect.PlSql)
		.extend(cfg -> cfg.plusOperators("->"))
		.format("SELECT `My field with \\` back () <<<<<< tick and a verryyyyyyyy long name` FROM MY_TABLE");

produces

SELECT
  `My field with \` back < < < < < < tick
  and a verryyyyyyyy long name ` FROM MY_TABLE

Which is no longer a valid query as the name has been split over multiple lines and whitespaces have been included. I think that the first ` is detected as the end of the name even though it is escaped with a \.

Is there any way to specify such an escape pattern in column names ?

fabiencelier avatar May 16 '23 13:05 fabiencelier