mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Add support for MySQL MEMBER OF (#1917)
This commit is contained in:
parent
418b94227a
commit
be2d2f14e7
5 changed files with 65 additions and 0 deletions
|
@ -4109,3 +4109,28 @@ fn parse_alter_table_drop_index() {
|
|||
AlterTableOperation::DropIndex { name } if name.value == "idx_index"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_json_member_of() {
|
||||
mysql().verified_stmt(r#"SELECT 17 MEMBER OF('[23, "abc", 17, "ab", 10]')"#);
|
||||
let sql = r#"SELECT 'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')"#;
|
||||
let stmt = mysql().verified_stmt(sql);
|
||||
match stmt {
|
||||
Statement::Query(query) => {
|
||||
let select = query.body.as_select().unwrap();
|
||||
assert_eq!(
|
||||
select.projection,
|
||||
vec![SelectItem::UnnamedExpr(Expr::MemberOf(MemberOf {
|
||||
value: Box::new(Expr::Value(
|
||||
Value::SingleQuotedString("ab".to_string()).into()
|
||||
)),
|
||||
array: Box::new(Expr::Value(
|
||||
Value::SingleQuotedString(r#"[23, "abc", 17, "ab", 10]"#.to_string())
|
||||
.into()
|
||||
)),
|
||||
}))]
|
||||
);
|
||||
}
|
||||
_ => panic!("Unexpected statement {stmt}"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue