You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Redshift dialect: -- and /* inside an operator should start a comment #2961
Postgres-family lexers never let -- or /* be part of an operator; the operator ends there and a comment starts. sqlparser lexes #- (and |/, ||/) as one token first, which leaves the rest of the comment marker behind.
select2#--'3, pg_backend_pid() --'
sqlparser 0.64.0: HashMinus, Minus, then the string '\n 3, pg_backend_pid() --'; parses as SELECT 2 #- -'...'.
Redshift: two columns, 1 (that is, 2 # 3) and 1073905994.
The same happens with /*: select 9 |/*'*/ 2, pg_backend_pid() --' returns 11 and the pid on Redshift, while sqlparser lexes PGSquareRoot, Mul, a string, and fails to parse.
Postgres documents the rule under "Operators" (https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-OPERATORS): "-- and /* cannot appear anywhere in an operator name, since they will be taken as the start of a comment." Postgres's own dialect in sqlparser likely has the same gap.
Activity