@@ -6210,16 +6210,10 @@ impl<'a> Parser<'a> {
6210
6210
} else {
6211
6211
let name = self . parse_object_name ( ) ?;
6212
6212
6213
- let partitions = if dialect_of ! ( self is MySqlDialect )
6213
+ let partitions: Vec < Ident > = if dialect_of ! ( self is MySqlDialect | GenericDialect )
6214
6214
&& self . parse_keyword ( Keyword :: PARTITION )
6215
6215
{
6216
- let mut partitions = self . parse_comma_separated ( |p| p. parse_tuple ( true , false ) ) ?;
6217
- if partitions. len ( ) != 1 {
6218
- return Err ( ParserError :: ParserError ( format ! (
6219
- "Partition expect one tuple"
6220
- ) ) ) ;
6221
- }
6222
- partitions. remove ( 0 )
6216
+ self . parse_partitions ( ) ?
6223
6217
} else {
6224
6218
vec ! [ ]
6225
6219
} ;
@@ -7430,6 +7424,13 @@ impl<'a> Parser<'a> {
7430
7424
representation : UserDefinedTypeRepresentation :: Composite { attributes } ,
7431
7425
} )
7432
7426
}
7427
+
7428
+ fn parse_partitions ( & mut self ) -> Result < Vec < Ident > , ParserError > {
7429
+ self . expect_token ( & Token :: LParen ) ?;
7430
+ let partitions = self . parse_comma_separated ( Parser :: parse_identifier) ?;
7431
+ self . expect_token ( & Token :: RParen ) ?;
7432
+ Ok ( partitions)
7433
+ }
7433
7434
}
7434
7435
7435
7436
impl Word {
@@ -8065,13 +8066,7 @@ mod tests {
8065
8066
if let TableFactor :: Table { partitions, .. } = table_factor {
8066
8067
let actual: Vec < & str > = partitions
8067
8068
. iter ( )
8068
- . map ( |expr| {
8069
- if let Expr :: Identifier ( ident) = & expr {
8070
- ident. value . as_str ( )
8071
- } else {
8072
- ""
8073
- }
8074
- } )
8069
+ . map ( |ident| ident. value . as_str ( ) )
8075
8070
. collect ( ) ;
8076
8071
assert_eq ! ( expected, actual) ;
8077
8072
}
0 commit comments