diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index ff5c161b9d5..cb94c84b8a5 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -1233,6 +1233,37 @@ count(*) over (order by a rows between current row and 3.14 following) from t1; ERROR HY000: Integer is required for ROWS-type frame +# +# EXCLUDE clause is parsed but not supported +# +select +count(*) over (order by a +rows between 1 preceding and 1 following +exclude current row) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +range between 1 preceding and 1 following +exclude ties) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +range between 1 preceding and 1 following +exclude group) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +rows between 1 preceding and 1 following +exclude no others) +from t1; +count(*) over (order by a +rows between 1 preceding and 1 following +exclude no others) +2 +2 drop table t1; # # Window function in grouping query diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 4106a8321f9..d2dcce57a87 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -762,6 +762,38 @@ select rows between current row and 3.14 following) from t1; +--echo # +--echo # EXCLUDE clause is parsed but not supported +--echo # + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + rows between 1 preceding and 1 following + exclude current row) +from t1; + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + range between 1 preceding and 1 following + exclude ties) +from t1; + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + range between 1 preceding and 1 following + exclude group) +from t1; + +# EXCLUDE NO OTHERS means 'don't exclude anything' +select + count(*) over (order by a + rows between 1 preceding and 1 following + exclude no others) +from t1; + drop table t1; --echo # diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 4636a9484f4..ec11075a498 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7156,4 +7156,7 @@ ER_WRONG_TYPE_FOR_ROWS_FRAME eng "Integer is required for ROWS-type frame" ER_WRONG_TYPE_FOR_RANGE_FRAME eng "Numeric datatype is required for RANGE-type frame" - +ER_FRAME_EXCLUSION_NOT_SUPPORTED + eng "Frame exclusion is not supported yet" +ER_WINDOW_FUNCTION_DONT_HAVE_FRAME + eng "This window function may not have a window frame" diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 7233828e3cc..c75b90d84d0 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -127,6 +127,12 @@ setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, DBUG_RETURN(1); } + if (win_spec->window_frame && + win_spec->window_frame->exclusion != Window_frame::EXCL_NONE) + { + my_error(ER_FRAME_EXCLUSION_NOT_SUPPORTED, MYF(0)); + DBUG_RETURN(1); + } /* For "win_func() OVER (ORDER BY order_list RANGE BETWEEN ...)", - ORDER BY order_list must not be ommitted