mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 13:40:22 +00:00
Support for Postgres array slice syntax (#1290)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
80c03f5c6a
commit
afa5f08db9
5 changed files with 356 additions and 61 deletions
|
@ -394,6 +394,36 @@ fn parse_semi_structured_data_traversal() {
|
|||
})],
|
||||
select.projection
|
||||
);
|
||||
|
||||
// a json access used as a key to another json access
|
||||
assert_eq!(
|
||||
snowflake().verified_expr("a[b:c]"),
|
||||
Expr::JsonAccess {
|
||||
value: Box::new(Expr::Identifier(Ident::new("a"))),
|
||||
path: JsonPath {
|
||||
path: vec![JsonPathElem::Bracket {
|
||||
key: Expr::JsonAccess {
|
||||
value: Box::new(Expr::Identifier(Ident::new("b"))),
|
||||
path: JsonPath {
|
||||
path: vec![JsonPathElem::Dot {
|
||||
key: "c".to_owned(),
|
||||
quoted: false
|
||||
}]
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// unquoted object keys cannot start with a digit
|
||||
assert_eq!(
|
||||
snowflake()
|
||||
.parse_sql_statements("SELECT a:42")
|
||||
.unwrap_err()
|
||||
.to_string(),
|
||||
"sql parser error: Expected variant object key name, found: 42"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue