File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1216,6 +1216,11 @@ pub trait Dialect: Debug + Any {
12161216 fn supports_quote_delimited_string ( & self ) -> bool {
12171217 false
12181218 }
1219+
1220+ /// Returns true if the dialect considers the `&&` operator as a boolean AND operator.
1221+ fn supports_overlap_as_and_operator ( & self ) -> bool {
1222+ false
1223+ }
12191224}
12201225
12211226/// This represents the operators for which precedence must be defined
Original file line number Diff line number Diff line change @@ -167,6 +167,11 @@ impl Dialect for MySqlDialect {
167167 fn supports_cross_join_constraint ( & self ) -> bool {
168168 true
169169 }
170+
171+ /// See: <https://dev.mysql.com/doc/refman/8.4/en/expressions.html>
172+ fn supports_overlap_as_and_operator ( & self ) -> bool {
173+ true
174+ }
170175}
171176
172177/// `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_overlap_as_and_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 @@ -17972,3 +17972,9 @@ fn parse_select_parenthesized_wildcard() {
1797217972 assert_eq!(select2.projection.len(), 1);
1797317973 assert!(matches!(select2.projection[0], SelectItem::Wildcard(_)));
1797417974}
17975+
17976+ #[test]
17977+ fn parse_overlap_as_bool_and() {
17978+ let dialects = all_dialects_where(|d| d.supports_overlap_as_and_operator());
17979+ dialects.one_statement_parses_to("SELECT x && y", "SELECT x AND y");
17980+ }
You can’t perform that action at this time.
0 commit comments