mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-09 18:04:59 +00:00
accept JSON_TABLE both as an unquoted table name and a table-valued function (#1134)
This commit is contained in:
parent
d59b6638fa
commit
1a07c5d67c
2 changed files with 20 additions and 1 deletions
|
@ -2328,6 +2328,21 @@ fn test_json() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_json_table_is_not_reserved() {
|
||||
// JSON_TABLE is not a reserved keyword in PostgreSQL, even though it is in SQL:2023
|
||||
// see: https://en.wikipedia.org/wiki/List_of_SQL_reserved_words
|
||||
let Select { from, .. } = pg_and_generic().verified_only_select("SELECT * FROM JSON_TABLE");
|
||||
assert_eq!(1, from.len());
|
||||
match &from[0].relation {
|
||||
TableFactor::Table {
|
||||
name: ObjectName(name),
|
||||
..
|
||||
} => assert_eq!("JSON_TABLE", name[0].value),
|
||||
other => panic!("Expected JSON_TABLE to be parsed as a table name, but got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_composite_value() {
|
||||
let sql = "SELECT (on_hand.item).name FROM on_hand WHERE (on_hand.item).price > 9";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue