mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 02:44:11 +00:00
Support TRIM
from with optional FROM
clause (#573)
* Split trimwhereFlag and trim_char expr to seperate members of Expr::Trim * update trim parsing logic to handle no flag + char from expr combo * add tests * Allow trim flag without trim_what expr * Add trim flag without trim_what test
This commit is contained in:
parent
31ba0012f7
commit
42c5d43b45
3 changed files with 42 additions and 18 deletions
|
@ -3928,7 +3928,15 @@ fn parse_trim() {
|
|||
"SELECT TRIM(TRAILING 'xyz' FROM 'xyzfooxyz')",
|
||||
);
|
||||
|
||||
one_statement_parses_to(
|
||||
"SELECT TRIM('xyz' FROM 'xyzfooxyz')",
|
||||
"SELECT TRIM('xyz' FROM 'xyzfooxyz')",
|
||||
);
|
||||
one_statement_parses_to("SELECT TRIM(' foo ')", "SELECT TRIM(' foo ')");
|
||||
one_statement_parses_to(
|
||||
"SELECT TRIM(LEADING ' foo ')",
|
||||
"SELECT TRIM(LEADING ' foo ')",
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
ParserError::ParserError("Expected ), found: 'xyz'".to_owned()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue