@@ -1339,27 +1339,34 @@ impl TryFromDialect<sqlparser::ast::Function> for Expr {
1339
1339
expr : next_expr ( ) ?,
1340
1340
distinct,
1341
1341
} )
1342
- } else if ident. value . eq_ignore_ascii_case ( "GROUP_CONCAT" ) {
1343
- Self :: Call ( FunctionExpr :: GroupConcat {
1344
- expr : next_expr ( ) ?,
1345
- separator,
1346
- } )
1347
- } else if ident. value . eq_ignore_ascii_case ( "MAX" ) {
1348
- Self :: Call ( FunctionExpr :: Max ( next_expr ( ) ?) )
1349
- } else if ident. value . eq_ignore_ascii_case ( "MIN" ) {
1350
- Self :: Call ( FunctionExpr :: Min ( next_expr ( ) ?) )
1351
- } else if ident. value . eq_ignore_ascii_case ( "SUM" ) {
1352
- Self :: Call ( FunctionExpr :: Sum {
1353
- expr : next_expr ( ) ?,
1354
- distinct,
1355
- } )
1356
1342
} else if ident. value . eq_ignore_ascii_case ( "DATE" ) {
1357
1343
// TODO: Arguably, this should be in a SQL rewrite pass to preserve input when rendering
1358
1344
Self :: Cast {
1359
1345
expr : next_expr ( ) ?,
1360
1346
ty : crate :: ast:: SqlType :: Date ,
1361
1347
postgres_style : false ,
1362
1348
}
1349
+ } else if ident. value . eq_ignore_ascii_case ( "EXTRACT" ) {
1350
+ return failed ! ( "{ident} should have been converted earlier" ) ;
1351
+ } else if ident. value . eq_ignore_ascii_case ( "GROUP_CONCAT" ) {
1352
+ Self :: Call ( FunctionExpr :: GroupConcat {
1353
+ expr : next_expr ( ) ?,
1354
+ separator,
1355
+ } )
1356
+ } else if ident. value . eq_ignore_ascii_case ( "JSON_OBJECT_AGG" ) {
1357
+ Self :: Call ( FunctionExpr :: JsonObjectAgg {
1358
+ key : next_expr ( ) ?,
1359
+ value : next_expr ( ) ?,
1360
+ allow_duplicate_keys : true ,
1361
+ } )
1362
+ } else if ident. value . eq_ignore_ascii_case ( "JSONB_OBJECT_AGG" )
1363
+ || ident. value . eq_ignore_ascii_case ( "JSON_OBJECTAGG" )
1364
+ {
1365
+ Self :: Call ( FunctionExpr :: JsonObjectAgg {
1366
+ key : next_expr ( ) ?,
1367
+ value : next_expr ( ) ?,
1368
+ allow_duplicate_keys : false ,
1369
+ } )
1363
1370
} else if ident. value . eq_ignore_ascii_case ( "LOWER" ) {
1364
1371
let expr = next_expr ( ) ?;
1365
1372
match * expr {
@@ -1372,6 +1379,20 @@ impl TryFromDialect<sqlparser::ast::Function> for Expr {
1372
1379
collation : None ,
1373
1380
} ) ,
1374
1381
}
1382
+ } else if ident. value . eq_ignore_ascii_case ( "MAX" ) {
1383
+ Self :: Call ( FunctionExpr :: Max ( next_expr ( ) ?) )
1384
+ } else if ident. value . eq_ignore_ascii_case ( "MIN" ) {
1385
+ Self :: Call ( FunctionExpr :: Min ( next_expr ( ) ?) )
1386
+ } else if ident. value . eq_ignore_ascii_case ( "ROW" ) {
1387
+ Self :: Row {
1388
+ explicit : true ,
1389
+ exprs : exprs. try_collect ( ) ?,
1390
+ }
1391
+ } else if ident. value . eq_ignore_ascii_case ( "SUM" ) {
1392
+ Self :: Call ( FunctionExpr :: Sum {
1393
+ expr : next_expr ( ) ?,
1394
+ distinct,
1395
+ } )
1375
1396
} else if ident. value . eq_ignore_ascii_case ( "UPPER" ) {
1376
1397
let expr = next_expr ( ) ?;
1377
1398
match * expr {
@@ -1384,22 +1405,6 @@ impl TryFromDialect<sqlparser::ast::Function> for Expr {
1384
1405
collation : None ,
1385
1406
} ) ,
1386
1407
}
1387
- } else if ident. value . eq_ignore_ascii_case ( "JSON_OBJECT_AGG" ) {
1388
- Self :: Call ( FunctionExpr :: JsonObjectAgg {
1389
- key : next_expr ( ) ?,
1390
- value : next_expr ( ) ?,
1391
- allow_duplicate_keys : true ,
1392
- } )
1393
- } else if ident. value . eq_ignore_ascii_case ( "JSONB_OBJECT_AGG" )
1394
- || ident. value . eq_ignore_ascii_case ( "JSON_OBJECTAGG" )
1395
- {
1396
- Self :: Call ( FunctionExpr :: JsonObjectAgg {
1397
- key : next_expr ( ) ?,
1398
- value : next_expr ( ) ?,
1399
- allow_duplicate_keys : false ,
1400
- } )
1401
- } else if ident. value . eq_ignore_ascii_case ( "EXTRACT" ) {
1402
- return failed ! ( "{ident} should have been converted earlier" ) ;
1403
1408
} else {
1404
1409
ident. value = ident. value . to_lowercase ( ) ;
1405
1410
Self :: Call ( FunctionExpr :: Call {
0 commit comments