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:
Ayush Dattagupta 2022-08-15 14:58:43 -07:00 committed by GitHub
parent 31ba0012f7
commit 42c5d43b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 18 deletions

View file

@ -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()),