LucaCappelletti94 opened a new pull request, #2576: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2576
Since #2144, MySQL's `&&` parses as `BinaryOperator::And`, but its precedence still came from the shared group that ranks the PostgreSQL overlap operator above the comparison operators. So `x < 1 && y > 2` parsed as `((x < (1 AND y)) > 2)` and `x = a && c` as `x = (a AND c)`. Both then printed with `AND`, which reads back as a different tree. MySQL ranks `&&` with `AND`, below every comparison (https://dev.mysql.com/doc/refman/8.4/en/operator-precedence.html). The precedence lookup now gives `Token::Overlap` the `AND` precedence whenever `supports_double_ampersand_operator()` holds, the same check `parse_infix` uses to build the `AND` node. PostgreSQL, Redshift and Generic keep `&&` as the overlap operator at its current precedence. The test added in #2144 now also checks that the comparison cases give the same trees as their `AND` spellings. -- 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]
