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 @@ -1221,6 +1221,11 @@ pub trait Dialect: Debug + Any {
12211221 fn supports_quote_delimited_string ( & self ) -> bool {
12221222 false
12231223 }
1224+
1225+ /// Returns true if the dialect considers the `&&` operator as a boolean AND operator.
1226+ fn supports_double_ampersand_operator ( & self ) -> bool {
1227+ false
1228+ }
12241229}
12251230
12261231/// 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 @@ -18037,3 +18037,9 @@ fn parse_select_parenthesized_wildcard() {
1803718037 assert_eq!(select2.projection.len(), 1);
1803818038 assert!(matches!(select2.projection[0], SelectItem::Wildcard(_)));
1803918039}
18040+
18041+ #[test]
18042+ fn parse_overlap_as_bool_and() {
18043+ let dialects = all_dialects_where(|d| d.supports_double_ampersand_operator());
18044+ dialects.one_statement_parses_to("SELECT x && y", "SELECT x AND y");
18045+ }
You can’t perform that action at this time.
0 commit comments