Hello Igor, I'm trying this example: create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3); select rank() over (order by a), rank() over (order by b) from t1; I put a breakpoint in order_window_funcs_by_window_specs(), at this call: int cmp= compare_window_spec_joined_lists(win_spec_prev, win_spec_curr); and I see that: (gdb) p win_spec1->partition_list $66 = (SQL_I_List<st_order> *) 0x7fff5c013038 (gdb) p win_spec2->partition_list $68 = (SQL_I_List<st_order> *) 0x7fff5c013038 // same as above (gdb) p win_spec2->partition_list[0] $70 = {<Sql_alloc> = {<No data fields>}, elements = 0, first = 0x0, next = 0x7fff5c013040} // Ok these are both empty lusts. (gdb) p win_spec2->order_list $72 = (SQL_I_List<st_order> *) 0x7fff5c013498 (gdb) p win_spec1->order_list $74 = (SQL_I_List<st_order> *) 0x7fff5c013050 (gdb) p win_spec2->order_list->first $76 = (st_order *) 0x7fff5c013428 (gdb) p win_spec1->order_list->first $78 = (st_order *) 0x7fff5c012fe0 // Ok these are different lists, as expected. Then, the code in compare_window_spec_joined_lists does this: { win_spec1->join_partition_and_order_lists(); win_spec2->join_partition_and_order_lists(); This will cause both window specs to have the same lists, and I will get item_window_func->marker=0 for the second item (instead of SORTORDER_CHANGE_FLAG that I expect). BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog