File tree Expand file tree Collapse file tree 9 files changed +36
-8
lines changed
Expand file tree Collapse file tree 9 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -162,4 +162,8 @@ impl Dialect for BigQueryDialect {
162162 fn supports_select_wildcard_replace ( & self ) -> bool {
163163 true
164164 }
165+
166+ fn supports_comma_separated_trim ( & self ) -> bool {
167+ true
168+ }
165169}
Original file line number Diff line number Diff line change @@ -141,4 +141,8 @@ impl Dialect for ClickHouseDialect {
141141 fn supports_select_wildcard_replace ( & self ) -> bool {
142142 true
143143 }
144+
145+ fn supports_comma_separated_trim ( & self ) -> bool {
146+ true
147+ }
144148}
Original file line number Diff line number Diff line change @@ -129,4 +129,8 @@ impl Dialect for DuckDbDialect {
129129 fn supports_select_wildcard_replace ( & self ) -> bool {
130130 true
131131 }
132+
133+ fn supports_comma_separated_trim ( & self ) -> bool {
134+ true
135+ }
132136}
Original file line number Diff line number Diff line change @@ -284,4 +284,8 @@ impl Dialect for GenericDialect {
284284 fn supports_key_column_option ( & self ) -> bool {
285285 true
286286 }
287+
288+ fn supports_comma_separated_trim ( & self ) -> bool {
289+ true
290+ }
287291}
Original file line number Diff line number Diff line change @@ -1651,6 +1651,12 @@ pub trait Dialect: Debug + Any {
16511651 fn supports_select_format ( & self ) -> bool {
16521652 false
16531653 }
1654+
1655+ /// Returns true if the dialect supports the two-argument comma-separated
1656+ /// form of the `TRIM` function: `TRIM(expr, characters)`.
1657+ fn supports_comma_separated_trim ( & self ) -> bool {
1658+ false
1659+ }
16541660}
16551661
16561662/// Operators for which precedence must be defined.
Original file line number Diff line number Diff line change @@ -306,4 +306,8 @@ impl Dialect for PostgreSqlDialect {
306306 fn supports_create_table_like_parenthesized ( & self ) -> bool {
307307 true
308308 }
309+
310+ fn supports_comma_separated_trim ( & self ) -> bool {
311+ true
312+ }
309313}
Original file line number Diff line number Diff line change @@ -667,6 +667,10 @@ impl Dialect for SnowflakeDialect {
667667 fn supports_lambda_functions ( & self ) -> bool {
668668 true
669669 }
670+
671+ fn supports_comma_separated_trim ( & self ) -> bool {
672+ true
673+ }
670674}
671675
672676// Peeks ahead to identify tokens that are expected after
Original file line number Diff line number Diff line change @@ -120,4 +120,8 @@ impl Dialect for SQLiteDialect {
120120 fn supports_notnull_operator ( & self ) -> bool {
121121 true
122122 }
123+
124+ fn supports_comma_separated_trim ( & self ) -> bool {
125+ true
126+ }
123127}
Original file line number Diff line number Diff line change @@ -2961,14 +2961,8 @@ impl<'a> Parser<'a> {
29612961 trim_what: Some(trim_what),
29622962 trim_characters: None,
29632963 })
2964- } else if self.consume_token(&Token::Comma)
2965- && dialect_of!(
2966- self is DuckDbDialect
2967- | SnowflakeDialect
2968- | BigQueryDialect
2969- | PostgreSqlDialect
2970- | GenericDialect
2971- )
2964+ } else if self.dialect.supports_comma_separated_trim()
2965+ && self.consume_token(&Token::Comma)
29722966 {
29732967 let characters = self.parse_comma_separated(Parser::parse_expr)?;
29742968 self.expect_token(&Token::RParen)?;
You can’t perform that action at this time.
0 commit comments