Skip to content

Commit 599e6dd

Browse files
SQLite: Support << and >> bitwise shift operators
1 parent 0cb62a1 commit 599e6dd

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎src/dialect/sqlite.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,8 @@ impl Dialect for SQLiteDialect {
129129
fn supports_numeric_literal_underscores(&self) -> bool {
130130
true
131131
}
132+
133+
fn supports_bitwise_shift_operators(&self) -> bool {
134+
true
135+
}
132136
}

‎tests/sqlparser_sqlite.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,17 @@ fn parse_pattern_operators_bind_at_like_precedence() {
957957
}
958958
}
959959

960+
#[test]
961+
fn parse_bitwise_shift_operators() {
962+
sqlite().verified_stmt("SELECT a << 1 FROM t");
963+
sqlite().verified_stmt("SELECT a >> 1 FROM t");
964+
965+
// A dialect without this support rejects the syntax
966+
let res = TestedDialects::new(vec![Box::new(sqlparser::dialect::HiveDialect {})])
967+
.parse_sql_statements("SELECT a << 1 FROM t");
968+
assert!(res.is_err());
969+
}
970+
960971
fn sqlite() -> TestedDialects {
961972
TestedDialects::new(vec![Box::new(SQLiteDialect {})])
962973
}

0 commit comments

Comments
 (0)