LucaCappelletti94 opened a new pull request, #2532:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2532

   Fuzz round-trip found `SELECT - -1` rendering as `SELECT --1`, which 
re-parses as a line comment in every dialect except MySQL, and `SELECT - @2` 
rendering as `SELECT -@2` in PostgreSQL, where `-@` retokenizes as one custom 
operator and parsing fails. Same fusion hits `- ~1` (`-~1`), `- !!2` (`-!!2`), 
`- ||/2` (`-||/2`) and `- #x` (`-# x`).
   
   `Expr::UnaryOp` display concatenates operator and operand in its final arm. 
The fix emits a space when the operator is `-` and the operand renders with a 
leading operator character. The first character is probed through a discarding 
write sink, so canonical output like `-1` or `-x` is unchanged and nothing 
allocates. Backtick-quoted operands and `-?` placeholders keep their current 
rendering because those dialects have no fusion rule and the characters stay 
out of the set.
   
   There are some other variants of this error, but they are sufficiently 
distinct that I believe it is best to adress them in distinct PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to