feat: Parse special keywords as functions (current_user, user, etc) (#561)

* feat: Parse special keywors as functions (current_user, user, etc)

* explain special field
This commit is contained in:
Dmitry Patsura 2022-08-11 15:30:06 +03:00 committed by GitHub
parent b6e36ad760
commit 54a29e872d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 111 additions and 17 deletions

View file

@ -572,6 +572,7 @@ fn parse_select_count_wildcard() {
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Wildcard)],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(only(&select.projection))
);
@ -590,6 +591,7 @@ fn parse_select_count_distinct() {
}))],
over: None,
distinct: true,
special: false,
}),
expr_from_projection(only(&select.projection))
);
@ -1414,6 +1416,7 @@ fn parse_select_having() {
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Wildcard)],
over: None,
distinct: false,
special: false,
})),
op: BinaryOperator::Gt,
right: Box::new(Expr::Value(number("1")))
@ -1445,7 +1448,8 @@ fn parse_select_qualify() {
}],
window_frame: None
}),
distinct: false
distinct: false,
special: false
})),
op: BinaryOperator::Eq,
right: Box::new(Expr::Value(number("1")))
@ -2532,6 +2536,7 @@ fn parse_scalar_function_in_projection() {
))],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(only(&select.projection))
);
@ -2610,6 +2615,7 @@ fn parse_named_argument_function() {
],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(only(&select.projection))
);
@ -2643,6 +2649,7 @@ fn parse_window_functions() {
window_frame: None,
}),
distinct: false,
special: false,
}),
expr_from_projection(&select.projection[0])
);
@ -2906,7 +2913,8 @@ fn parse_at_timezone() {
}]),
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(zero.clone()))],
over: None,
distinct: false
distinct: false,
special: false,
})),
time_zone: "UTC-06:00".to_string()
},
@ -2932,6 +2940,7 @@ fn parse_at_timezone() {
args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(zero,),),],
over: None,
distinct: false,
special: false
},)),
time_zone: "UTC-06:00".to_string(),
},),),
@ -2941,6 +2950,7 @@ fn parse_at_timezone() {
],
over: None,
distinct: false,
special: false
},),
alias: Ident {
value: "hour".to_string(),
@ -2976,6 +2986,7 @@ fn parse_table_function() {
)))],
over: None,
distinct: false,
special: false,
});
assert_eq!(expr, expected_expr);
assert_eq!(alias, table_alias("a"))
@ -3148,6 +3159,7 @@ fn parse_delimited_identifiers() {
args: vec![],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(&select.projection[1]),
);
@ -5125,6 +5137,7 @@ fn parse_time_functions() {
args: vec![],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(&select.projection[0])
);
@ -5140,6 +5153,7 @@ fn parse_time_functions() {
args: vec![],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(&select.projection[0])
);
@ -5155,6 +5169,7 @@ fn parse_time_functions() {
args: vec![],
over: None,
distinct: false,
special: false,
}),
expr_from_projection(&select.projection[0])
);