Formatting One of Snowflakes RLIKE Syntaxes Adds Superfluous Whitespace
Describe the bug
Snowflakes RLIKE has two valid syntaxes. When formatting a Snowflake SQL script that uses the first syntax mentioned in the documentation, sqlfmt adds a whitespace between E and (.
To Reproduce
Format the following:
select rlike('foo', 'bar') from dual;
Expected behavior
select rlike('foo', 'bar')
from dual
;
Actual behavior
select rlike ('foo', 'bar')
from dual
;
Additional context sqlfmt, version 0.19.2
thanks for the report. Snowflake has similar syntax for like, ilike, etc., as functions instead of infix operators.
While this formatting isn't ideal, snowflake parses it and accepts it as valid.
A quick search of the other major dialects suggests this is snowflake-only.
I'm not going to tackle this right now -- because of how the lexer and parser work, it's non-trivial to distinguish between rlike('foo, bar') and rlike('foo', 'bar') when these tokens are lexed, which unfortunately determines the presence or absence of whitespace between the function or operator name and the parenthesis.