File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1226,6 +1226,11 @@ pub trait Dialect: Debug + Any {
12261226 fn supports_quote_delimited_string ( & self ) -> bool {
12271227 false
12281228 }
1229+
1230+ /// Returns true if the dialect considers the `&&` operator as a boolean AND operator.
1231+ fn supports_double_ampersand_operator ( & self ) -> bool {
1232+ false
1233+ }
12291234}
12301235
12311236/// This represents the operators for which precedence must be defined
Original file line number Diff line number Diff line change @@ -171,6 +171,11 @@ impl Dialect for MySqlDialect {
171171 fn supports_cross_join_constraint ( & self ) -> bool {
172172 true
173173 }
174+
175+ /// See: <https://dev.mysql.com/doc/refman/8.4/en/expressions.html>
176+ fn supports_double_ampersand_operator ( & self ) -> bool {
177+ true
178+ }
174179}
175180
176181/// `LOCK TABLES`
Original file line number Diff line number Diff line change @@ -3500,6 +3500,9 @@ impl<'a> Parser<'a> {
35003500 Token::Overlap if dialect_is!(dialect is PostgreSqlDialect | GenericDialect) => {
35013501 Some(BinaryOperator::PGOverlap)
35023502 }
3503+ Token::Overlap if dialect.supports_double_ampersand_operator() => {
3504+ Some(BinaryOperator::And)
3505+ }
35033506 Token::CaretAt if dialect_is!(dialect is PostgreSqlDialect | GenericDialect) => {
35043507 Some(BinaryOperator::PGStartsWith)
35053508 }
Original file line number Diff line number Diff line change @@ -18063,3 +18063,9 @@ fn parse_select_parenthesized_wildcard() {
1806318063 assert_eq!(select2.projection.len(), 1);
1806418064 assert!(matches!(select2.projection[0], SelectItem::Wildcard(_)));
1806518065}
18066+
18067+ #[test]
18068+ fn parse_overlap_as_bool_and() {
18069+ let dialects = all_dialects_where(|d| d.supports_double_ampersand_operator());
18070+ dialects.one_statement_parses_to("SELECT x && y", "SELECT x AND y");
18071+ }
You can’t perform that action at this time.
0 commit comments