mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
MDEV-17137: Syntax errors with VIEW using MEDIAN
The syntax error happened because we had not implemented a different print for percentile functions. The syntax is a bit different when we use percentile functions as window functions in comparision to normal window functions. Implemented a seperate print function for percentile functions
This commit is contained in:
parent
103b1df510
commit
97a37edc97
6 changed files with 66 additions and 3 deletions
|
|
@ -545,6 +545,11 @@ void Item_sum_hybrid_simple::update_field()
|
|||
|
||||
void Item_window_func::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
if (only_single_element_order_list())
|
||||
{
|
||||
print_for_percentile_functions(str, query_type);
|
||||
return;
|
||||
}
|
||||
window_func()->print(str, query_type);
|
||||
str->append(" over ");
|
||||
#ifndef DBUG_OFF
|
||||
|
|
@ -554,3 +559,15 @@ void Item_window_func::print(String *str, enum_query_type query_type)
|
|||
#endif
|
||||
window_spec->print(str, query_type);
|
||||
}
|
||||
void Item_window_func::print_for_percentile_functions(String *str, enum_query_type query_type)
|
||||
{
|
||||
window_func()->print(str, query_type);
|
||||
str->append(" within group ");
|
||||
str->append('(');
|
||||
window_spec->print_order(str,query_type);
|
||||
str->append(')');
|
||||
str->append(" over ");
|
||||
str->append('(');
|
||||
window_spec->print_partition(str,query_type);
|
||||
str->append(')');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue