Details

    Description

      CREATE TABLE t1 (i1 int, a int);
      INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
       
      CREATE TABLE t2 (i2 int);
      INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
       
      SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
      FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t;
      

      #3  <signal handler called>
      #4  0x0000560fe20e66c1 in Item_field::used_tables (this=0x7fb66817e350) at /10.2/sql/item.cc:2876
      #5  0x0000560fe21a378e in Item_sum::update_used_tables (this=0x7fb668179870) at /10.2/sql/item_sum.cc:546
      #6  0x0000560fe21a2be6 in Item_sum::check_sum_func (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_sum.cc:312
      #7  0x0000560fe22b8018 in Item_sum_hybrid_simple::fix_fields (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:273
      #8  0x0000560fe22b77eb in Item_window_func::fix_fields (this=0x7fb66817e470, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:102
      #9  0x0000560fe1df2065 in setup_fields (thd=0x7fb668000a98, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fb668062400, pre_fix=0x7fb668004ee0, allow_sum_func=true) at /10.2/sql/sql_base.cc:7058
      #10 0x0000560fe1e98b4a in JOIN::prepare (this=0x7fb6680620b0, tables_init=0x7fb6681842b0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fb668004d90, unit_arg=0x7fb668004638) at /10.2/sql/sql_select.cc:806
      #11 0x0000560fe1ea3080 in mysql_select (thd=0x7fb668000a98, tables=0x7fb6681842b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb668179e50, unit=0x7fb668004638, select_lex=0x7fb668004d90) at /10.2/sql/sql_select.cc:3713
      #12 0x0000560fe1e9783b in handle_select (thd=0x7fb668000a98, lex=0x7fb668004570, result=0x7fb668179e50, setup_tables_done_option=0) at /10.2/sql/sql_select.cc:373
      #13 0x0000560fe1e637e4 in execute_sqlcom_select (thd=0x7fb668000a98, all_tables=0x7fb6681842b0) at /10.2/sql/sql_parse.cc:6456
      #14 0x0000560fe1e59562 in mysql_execute_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:3467
      #15 0x0000560fe1e67158 in mysql_parse (thd=0x7fb668000a98, rawbuf=0x7fb66806aa10 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", length=94, parser_state=0x7fb6842561f0, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7898
      #16 0x0000560fe1e54e01 in dispatch_command (command=COM_QUERY, thd=0x7fb668000a98, packet=0x7fb668007fe9 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", packet_length=94, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1806
      #17 0x0000560fe1e5375d in do_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:1360
      #18 0x0000560fe1fa18e7 in do_handle_one_connection (connect=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1335
      #19 0x0000560fe1fa1667 in handle_one_connection (arg=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1241
      #20 0x0000560fe22ff01a in pfs_spawn_thread (arg=0x560fe3f68908) at /10.2/storage/perfschema/pfs.cc:1862
      #21 0x00007fb68a3c06ba in start_thread (arg=0x7fb684257700) at pthread_create.c:333
      #22 0x00007fb68985541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa created issue -
            alice Alice Sherepa added a comment -

            still reproducible on 10.2

            10.2 26432e49d37a37

             
            ==11537==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x56362a69f395 bp 0x7fc2c015de10 sp 0x7fc2c015de00 T27)
                #0 0x56362a69f394 in Item_field::used_tables() const /10.2/sql/item.cc:2942
                #1 0x56362a85c60b in Item_sum::update_used_tables() /10.2/sql/item_sum.cc:546
                #2 0x56362a85a2e5 in Item_sum::check_sum_func(THD*, Item**) /10.2/sql/item_sum.cc:312
                #3 0x56362aaed82e in Item_sum_hybrid_simple::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:275
                #4 0x56362aaec1d0 in Item_window_func::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:102
                #5 0x563629fa2d4c in setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool) /10.2/sql/sql_base.cc:7160
                #6 0x56362a1250c0 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /10.2/sql/sql_select.cc:814
                #7 0x56362a141e07 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /10.2/sql/sql_select.cc:3796
                #8 0x56362a1217e4 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:376
                #9 0x56362a0a9154 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6477
                #10 0x56362a09661a in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3535
                #11 0x56362a0b18b8 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:8011
                #12 0x56362a08cf6d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1832
                #13 0x56362a08a0ec in do_command(THD*) /10.2/sql/sql_parse.cc:1386
                #14 0x56362a3b1d61 in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1335
                #15 0x56362a3b1769 in handle_one_connection /10.2/sql/sql_connect.cc:1241
                #16 0x56362b562fef in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1862
                #17 0x7fc2d775a6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
                #18 0x7fc2d6bef41c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
            
            

            alice Alice Sherepa added a comment - still reproducible on 10.2 10.2 26432e49d37a37   ==11537==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x56362a69f395 bp 0x7fc2c015de10 sp 0x7fc2c015de00 T27) #0 0x56362a69f394 in Item_field::used_tables() const /10.2/sql/item.cc:2942 #1 0x56362a85c60b in Item_sum::update_used_tables() /10.2/sql/item_sum.cc:546 #2 0x56362a85a2e5 in Item_sum::check_sum_func(THD*, Item**) /10.2/sql/item_sum.cc:312 #3 0x56362aaed82e in Item_sum_hybrid_simple::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:275 #4 0x56362aaec1d0 in Item_window_func::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:102 #5 0x563629fa2d4c in setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool) /10.2/sql/sql_base.cc:7160 #6 0x56362a1250c0 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /10.2/sql/sql_select.cc:814 #7 0x56362a141e07 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /10.2/sql/sql_select.cc:3796 #8 0x56362a1217e4 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:376 #9 0x56362a0a9154 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6477 #10 0x56362a09661a in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3535 #11 0x56362a0b18b8 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:8011 #12 0x56362a08cf6d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1832 #13 0x56362a08a0ec in do_command(THD*) /10.2/sql/sql_parse.cc:1386 #14 0x56362a3b1d61 in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1335 #15 0x56362a3b1769 in handle_one_connection /10.2/sql/sql_connect.cc:1241 #16 0x56362b562fef in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1862 #17 0x7fc2d775a6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9) #18 0x7fc2d6bef41c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
            alice Alice Sherepa made changes -
            Field Original Value New Value
            Affects Version/s 10.3 [ 22126 ]
            alice Alice Sherepa made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            alice Alice Sherepa made changes -
            Assignee Vicentiu Ciorbaru [ cvicentiu ] Varun Gupta [ varun ]
            alice Alice Sherepa added a comment - - edited

            Another test case, but this one crashes on 10.2-10.4.

            create table t1 (a int);
            insert into t1 values (1), (2), (3);
            select lead(max(a) over (partition by a)) over (order by a)  from t1 group by a;
            

            10.2 1e9c2b2305c10ccaad2

               ==14474==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x55864c9ece4d bp 0x7f93aa69fdd0 sp 0x7f93aa69fdc0 T27)
                #0 0x55864c9ece4c in Item_field::used_tables() const /10.2/sql/item.cc:2942
                #1 0x55864ce3934a in Item_window_func::update_used_tables() /10.2/sql/item_windowfunc.cc:58
                #2 0x55864cba9c7e in Item_sum::update_used_tables() /10.2/sql/item_sum.cc:545
                #3 0x55864cba7a73 in Item_sum::check_sum_func(THD*, Item**) /10.2/sql/item_sum.cc:312
                #4 0x55864ce3b110 in Item_sum_hybrid_simple::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:275
                #5 0x55864ce39ab2 in Item_window_func::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:102
                #6 0x55864c2f04dc in setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool) /10.2/sql/sql_base.cc:7160
                #7 0x55864c472850 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /10.2/sql/sql_select.cc:814
                #8 0x55864c48f597 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /10.2/sql/sql_select.cc:3796
                #9 0x55864c46ef74 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:376
                #10 0x55864c3f68e4 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6479
                #11 0x55864c3e3daa in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3537
                #12 0x55864c3ff048 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:8013
                #13 0x55864c3da6fd in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1832
                #14 0x55864c3d787c in do_command(THD*) /10.2/sql/sql_parse.cc:1386
                #15 0x55864c6ff65d in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1335
                #16 0x55864c6ff065 in handle_one_connection /10.2/sql/sql_connect.cc:1241
                #17 0x55864d8b6a85 in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1862
                #18 0x7f93c1ca06b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
                #19 0x7f93c113541c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
                

            alice Alice Sherepa added a comment - - edited Another test case, but this one crashes on 10.2-10.4. create table t1 (a int ); insert into t1 values (1), (2), (3); select lead( max (a) over (partition by a)) over ( order by a) from t1 group by a; 10.2 1e9c2b2305c10ccaad2 ==14474==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x55864c9ece4d bp 0x7f93aa69fdd0 sp 0x7f93aa69fdc0 T27) #0 0x55864c9ece4c in Item_field::used_tables() const /10.2/sql/item.cc:2942 #1 0x55864ce3934a in Item_window_func::update_used_tables() /10.2/sql/item_windowfunc.cc:58 #2 0x55864cba9c7e in Item_sum::update_used_tables() /10.2/sql/item_sum.cc:545 #3 0x55864cba7a73 in Item_sum::check_sum_func(THD*, Item**) /10.2/sql/item_sum.cc:312 #4 0x55864ce3b110 in Item_sum_hybrid_simple::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:275 #5 0x55864ce39ab2 in Item_window_func::fix_fields(THD*, Item**) /10.2/sql/item_windowfunc.cc:102 #6 0x55864c2f04dc in setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool) /10.2/sql/sql_base.cc:7160 #7 0x55864c472850 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /10.2/sql/sql_select.cc:814 #8 0x55864c48f597 in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /10.2/sql/sql_select.cc:3796 #9 0x55864c46ef74 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:376 #10 0x55864c3f68e4 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6479 #11 0x55864c3e3daa in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3537 #12 0x55864c3ff048 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:8013 #13 0x55864c3da6fd in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1832 #14 0x55864c3d787c in do_command(THD*) /10.2/sql/sql_parse.cc:1386 #15 0x55864c6ff65d in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1335 #16 0x55864c6ff065 in handle_one_connection /10.2/sql/sql_connect.cc:1241 #17 0x55864d8b6a85 in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1862 #18 0x7f93c1ca06b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9) #19 0x7f93c113541c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
            alice Alice Sherepa made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            alice Alice Sherepa added a comment -

            please check also test case from MDEV-20592:

            drop table if exists t;
             create table t(a int) engine=innodb;
             select ntile(5) over(), 
              last_value(std(0) over(w2 partition by a)) 
              over(order by a) 
             from t window w1 as (w2 order by a);
            

            alice Alice Sherepa added a comment - please check also test case from MDEV-20592 : drop table if exists t; create table t(a int ) engine=innodb; select ntile(5) over(), last_value(std(0) over(w2 partition by a)) over( order by a) from t window w1 as (w2 order by a);
            alice Alice Sherepa made changes -
            Description {code:sql}
            CREATE TABLE t1 (i1 int, a int);
            INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);

            CREATE TABLE t2 (i2 int);
            INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);

            SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
            FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t;
            {code}

            {noformat}
            180202 14:56:29 [ERROR] mysqld got signal 11 ;
            Server version: 10.2.13-MariaDB-debug-log
            key_buffer_size=1048576
            read_buffer_size=131072
            max_used_connections=1
            max_threads=153
            thread_count=2
            It is possible that mysqld could use up to
            key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63175 K bytes of memory
            Hope that's ok; if not, decrease some variables in the equation.

            Thread pointer: 0x7fb668000a98
            Attempting backtrace. You can use the following information to find out
            where mysqld died. If you see no messages after this, something went
            terribly wrong...
            stack_bottom = 0x7fb684256e70 thread_stack 0x49000
            /home/alice/git/10.2/sql/mysqld(my_print_stacktrace+0x38)[0x560fe28397f3]
            /home/alice/git/10.2/sql/mysqld(handle_fatal_signal+0x3dc)[0x560fe20c9b4b]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fb68a3ca390]
            /home/alice/git/10.2/sql/mysqld(_ZNK10Item_field11used_tablesEv+0x17)[0x560fe20e66c1]
            /home/alice/git/10.2/sql/mysqld(_ZN8Item_sum18update_used_tablesEv+0xce)[0x560fe21a378e]
            mysys/stacktrace.c:267(my_print_stacktrace)[0x560fe21a2be6]
            sql/item.cc:2876(Item_field::used_tables() const)[0x560fe22b8018]
            sql/item_windowfunc.cc:102(Item_window_func::fix_fields(THD*, Item**))[0x560fe22b77eb]
            sql/sql_base.cc:7058(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool))[0x560fe1df2065]
            sql/sql_select.cc:806(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x560fe1e98b4a]
            sql/sql_select.cc:3713(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x560fe1ea3080]
            sql/sql_select.cc:373(handle_select(THD*, LEX*, select_result*, unsigned long))[0x560fe1e9783b]
            sql/sql_parse.cc:6456(execute_sqlcom_select(THD*, TABLE_LIST*))[0x560fe1e637e4]
            sql/sql_parse.cc:3467(mysql_execute_command(THD*))[0x560fe1e59562]
            sql/sql_parse.cc:7898(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x560fe1e67158]
            sql/sql_parse.cc:1808(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x560fe1e54e01]
            sql/sql_parse.cc:1360(do_command(THD*))[0x560fe1e5375d]
            sql/sql_connect.cc:1335(do_handle_one_connection(CONNECT*))[0x560fe1fa18e7]
            sql/sql_connect.cc:1242(handle_one_connection)[0x560fe1fa1667]
            perfschema/pfs.cc:1864(pfs_spawn_thread)[0x560fe22ff01a]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fb68a3c06ba]
            /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb68985541d]

            Trying to get some variables.
            Some pointers may be invalid and cause the dump to abort.
            Query (0x7fb66806aa10): SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t
            Connection ID (thread ID): 4
            Status: NOT_KILLED
            {noformat}

            {noformat}
            Thread 1 (Thread 0x7fb684257700 (LWP 13032)):
            #0 __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
            #1 0x0000560fe28398e5 in my_write_core (sig=11) at /home/alice/git/10.2/mysys/stacktrace.c:477
            #2 0x0000560fe20c9f73 in handle_fatal_signal (sig=11) at /home/alice/git/10.2/sql/signal_handler.cc:305
            #3 <signal handler called>
            #4 0x0000560fe20e66c1 in Item_field::used_tables (this=0x7fb66817e350) at /home/alice/git/10.2/sql/item.cc:2876
            #5 0x0000560fe21a378e in Item_sum::update_used_tables (this=0x7fb668179870) at /home/alice/git/10.2/sql/item_sum.cc:546
            #6 0x0000560fe21a2be6 in Item_sum::check_sum_func (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /home/alice/git/10.2/sql/item_sum.cc:312
            #7 0x0000560fe22b8018 in Item_sum_hybrid_simple::fix_fields (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /home/alice/git/10.2/sql/item_windowfunc.cc:273
            #8 0x0000560fe22b77eb in Item_window_func::fix_fields (this=0x7fb66817e470, thd=0x7fb668000a98, ref=0x7fb668111580) at /home/alice/git/10.2/sql/item_windowfunc.cc:102
            #9 0x0000560fe1df2065 in setup_fields (thd=0x7fb668000a98, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fb668062400, pre_fix=0x7fb668004ee0, allow_sum_func=true) at /home/alice/git/10.2/sql/sql_base.cc:7058
            #10 0x0000560fe1e98b4a in JOIN::prepare (this=0x7fb6680620b0, tables_init=0x7fb6681842b0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fb668004d90, unit_arg=0x7fb668004638) at /home/alice/git/10.2/sql/sql_select.cc:806
            #11 0x0000560fe1ea3080 in mysql_select (thd=0x7fb668000a98, tables=0x7fb6681842b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb668179e50, unit=0x7fb668004638, select_lex=0x7fb668004d90) at /home/alice/git/10.2/sql/sql_select.cc:3713
            #12 0x0000560fe1e9783b in handle_select (thd=0x7fb668000a98, lex=0x7fb668004570, result=0x7fb668179e50, setup_tables_done_option=0) at /home/alice/git/10.2/sql/sql_select.cc:373
            #13 0x0000560fe1e637e4 in execute_sqlcom_select (thd=0x7fb668000a98, all_tables=0x7fb6681842b0) at /home/alice/git/10.2/sql/sql_parse.cc:6456
            #14 0x0000560fe1e59562 in mysql_execute_command (thd=0x7fb668000a98) at /home/alice/git/10.2/sql/sql_parse.cc:3467
            #15 0x0000560fe1e67158 in mysql_parse (thd=0x7fb668000a98, rawbuf=0x7fb66806aa10 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", length=94, parser_state=0x7fb6842561f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:7898
            #16 0x0000560fe1e54e01 in dispatch_command (command=COM_QUERY, thd=0x7fb668000a98, packet=0x7fb668007fe9 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", packet_length=94, is_com_multi=false, is_next_command=false) at /home/alice/git/10.2/sql/sql_parse.cc:1806
            #17 0x0000560fe1e5375d in do_command (thd=0x7fb668000a98) at /home/alice/git/10.2/sql/sql_parse.cc:1360
            #18 0x0000560fe1fa18e7 in do_handle_one_connection (connect=0x560fe4008d48) at /home/alice/git/10.2/sql/sql_connect.cc:1335
            #19 0x0000560fe1fa1667 in handle_one_connection (arg=0x560fe4008d48) at /home/alice/git/10.2/sql/sql_connect.cc:1241
            #20 0x0000560fe22ff01a in pfs_spawn_thread (arg=0x560fe3f68908) at /home/alice/git/10.2/storage/perfschema/pfs.cc:1862
            #21 0x00007fb68a3c06ba in start_thread (arg=0x7fb684257700) at pthread_create.c:333
            #22 0x00007fb68985541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
            {noformat}
            {code:sql}
            CREATE TABLE t1 (i1 int, a int);
            INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);

            CREATE TABLE t2 (i2 int);
            INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);

            SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
            FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t;
            {code}

            {noformat}

            /10.2/sql/mysqld(handle_fatal_signal+0x3dc)[0x560fe20c9b4b]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fb68a3ca390]
            /10.2/sql/mysqld(_ZNK10Item_field11used_tablesEv+0x17)[0x560fe20e66c1]
            /10.2/sql/mysqld(_ZN8Item_sum18update_used_tablesEv+0xce)[0x560fe21a378e]
            mysys/stacktrace.c:267(my_print_stacktrace)[0x560fe21a2be6]
            sql/item.cc:2876(Item_field::used_tables() const)[0x560fe22b8018]
            sql/item_windowfunc.cc:102(Item_window_func::fix_fields(THD*, Item**))[0x560fe22b77eb]
            sql/sql_base.cc:7058(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool))[0x560fe1df2065]
            sql/sql_select.cc:806(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x560fe1e98b4a]
            sql/sql_select.cc:3713(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x560fe1ea3080]
            sql/sql_select.cc:373(handle_select(THD*, LEX*, select_result*, unsigned long))[0x560fe1e9783b]
            sql/sql_parse.cc:6456(execute_sqlcom_select(THD*, TABLE_LIST*))[0x560fe1e637e4]
            sql/sql_parse.cc:3467(mysql_execute_command(THD*))[0x560fe1e59562]
            sql/sql_parse.cc:7898(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x560fe1e67158]
            sql/sql_parse.cc:1808(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x560fe1e54e01]
            sql/sql_parse.cc:1360(do_command(THD*))[0x560fe1e5375d]
            sql/sql_connect.cc:1335(do_handle_one_connection(CONNECT*))[0x560fe1fa18e7]
            sql/sql_connect.cc:1242(handle_one_connection)[0x560fe1fa1667]
            perfschema/pfs.cc:1864(pfs_spawn_thread)[0x560fe22ff01a]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fb68a3c06ba]
            /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb68985541d]
            {noformat}

            {noformat}
            #3 <signal handler called>
            #4 0x0000560fe20e66c1 in Item_field::used_tables (this=0x7fb66817e350) at /10.2/sql/item.cc:2876
            #5 0x0000560fe21a378e in Item_sum::update_used_tables (this=0x7fb668179870) at /10.2/sql/item_sum.cc:546
            #6 0x0000560fe21a2be6 in Item_sum::check_sum_func (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_sum.cc:312
            #7 0x0000560fe22b8018 in Item_sum_hybrid_simple::fix_fields (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:273
            #8 0x0000560fe22b77eb in Item_window_func::fix_fields (this=0x7fb66817e470, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:102
            #9 0x0000560fe1df2065 in setup_fields (thd=0x7fb668000a98, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fb668062400, pre_fix=0x7fb668004ee0, allow_sum_func=true) at /10.2/sql/sql_base.cc:7058
            #10 0x0000560fe1e98b4a in JOIN::prepare (this=0x7fb6680620b0, tables_init=0x7fb6681842b0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fb668004d90, unit_arg=0x7fb668004638) at /10.2/sql/sql_select.cc:806
            #11 0x0000560fe1ea3080 in mysql_select (thd=0x7fb668000a98, tables=0x7fb6681842b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb668179e50, unit=0x7fb668004638, select_lex=0x7fb668004d90) at /10.2/sql/sql_select.cc:3713
            #12 0x0000560fe1e9783b in handle_select (thd=0x7fb668000a98, lex=0x7fb668004570, result=0x7fb668179e50, setup_tables_done_option=0) at /10.2/sql/sql_select.cc:373
            #13 0x0000560fe1e637e4 in execute_sqlcom_select (thd=0x7fb668000a98, all_tables=0x7fb6681842b0) at /10.2/sql/sql_parse.cc:6456
            #14 0x0000560fe1e59562 in mysql_execute_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:3467
            #15 0x0000560fe1e67158 in mysql_parse (thd=0x7fb668000a98, rawbuf=0x7fb66806aa10 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", length=94, parser_state=0x7fb6842561f0, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7898
            #16 0x0000560fe1e54e01 in dispatch_command (command=COM_QUERY, thd=0x7fb668000a98, packet=0x7fb668007fe9 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", packet_length=94, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1806
            #17 0x0000560fe1e5375d in do_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:1360
            #18 0x0000560fe1fa18e7 in do_handle_one_connection (connect=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1335
            #19 0x0000560fe1fa1667 in handle_one_connection (arg=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1241
            #20 0x0000560fe22ff01a in pfs_spawn_thread (arg=0x560fe3f68908) at /10.2/storage/perfschema/pfs.cc:1862
            #21 0x00007fb68a3c06ba in start_thread (arg=0x7fb684257700) at pthread_create.c:333
            #22 0x00007fb68985541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
            {noformat}
            alice Alice Sherepa made changes -
            Description {code:sql}
            CREATE TABLE t1 (i1 int, a int);
            INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);

            CREATE TABLE t2 (i2 int);
            INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);

            SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
            FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t;
            {code}

            {noformat}

            /10.2/sql/mysqld(handle_fatal_signal+0x3dc)[0x560fe20c9b4b]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fb68a3ca390]
            /10.2/sql/mysqld(_ZNK10Item_field11used_tablesEv+0x17)[0x560fe20e66c1]
            /10.2/sql/mysqld(_ZN8Item_sum18update_used_tablesEv+0xce)[0x560fe21a378e]
            mysys/stacktrace.c:267(my_print_stacktrace)[0x560fe21a2be6]
            sql/item.cc:2876(Item_field::used_tables() const)[0x560fe22b8018]
            sql/item_windowfunc.cc:102(Item_window_func::fix_fields(THD*, Item**))[0x560fe22b77eb]
            sql/sql_base.cc:7058(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool))[0x560fe1df2065]
            sql/sql_select.cc:806(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x560fe1e98b4a]
            sql/sql_select.cc:3713(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x560fe1ea3080]
            sql/sql_select.cc:373(handle_select(THD*, LEX*, select_result*, unsigned long))[0x560fe1e9783b]
            sql/sql_parse.cc:6456(execute_sqlcom_select(THD*, TABLE_LIST*))[0x560fe1e637e4]
            sql/sql_parse.cc:3467(mysql_execute_command(THD*))[0x560fe1e59562]
            sql/sql_parse.cc:7898(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x560fe1e67158]
            sql/sql_parse.cc:1808(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x560fe1e54e01]
            sql/sql_parse.cc:1360(do_command(THD*))[0x560fe1e5375d]
            sql/sql_connect.cc:1335(do_handle_one_connection(CONNECT*))[0x560fe1fa18e7]
            sql/sql_connect.cc:1242(handle_one_connection)[0x560fe1fa1667]
            perfschema/pfs.cc:1864(pfs_spawn_thread)[0x560fe22ff01a]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fb68a3c06ba]
            /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb68985541d]
            {noformat}

            {noformat}
            #3 <signal handler called>
            #4 0x0000560fe20e66c1 in Item_field::used_tables (this=0x7fb66817e350) at /10.2/sql/item.cc:2876
            #5 0x0000560fe21a378e in Item_sum::update_used_tables (this=0x7fb668179870) at /10.2/sql/item_sum.cc:546
            #6 0x0000560fe21a2be6 in Item_sum::check_sum_func (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_sum.cc:312
            #7 0x0000560fe22b8018 in Item_sum_hybrid_simple::fix_fields (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:273
            #8 0x0000560fe22b77eb in Item_window_func::fix_fields (this=0x7fb66817e470, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:102
            #9 0x0000560fe1df2065 in setup_fields (thd=0x7fb668000a98, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fb668062400, pre_fix=0x7fb668004ee0, allow_sum_func=true) at /10.2/sql/sql_base.cc:7058
            #10 0x0000560fe1e98b4a in JOIN::prepare (this=0x7fb6680620b0, tables_init=0x7fb6681842b0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fb668004d90, unit_arg=0x7fb668004638) at /10.2/sql/sql_select.cc:806
            #11 0x0000560fe1ea3080 in mysql_select (thd=0x7fb668000a98, tables=0x7fb6681842b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb668179e50, unit=0x7fb668004638, select_lex=0x7fb668004d90) at /10.2/sql/sql_select.cc:3713
            #12 0x0000560fe1e9783b in handle_select (thd=0x7fb668000a98, lex=0x7fb668004570, result=0x7fb668179e50, setup_tables_done_option=0) at /10.2/sql/sql_select.cc:373
            #13 0x0000560fe1e637e4 in execute_sqlcom_select (thd=0x7fb668000a98, all_tables=0x7fb6681842b0) at /10.2/sql/sql_parse.cc:6456
            #14 0x0000560fe1e59562 in mysql_execute_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:3467
            #15 0x0000560fe1e67158 in mysql_parse (thd=0x7fb668000a98, rawbuf=0x7fb66806aa10 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", length=94, parser_state=0x7fb6842561f0, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7898
            #16 0x0000560fe1e54e01 in dispatch_command (command=COM_QUERY, thd=0x7fb668000a98, packet=0x7fb668007fe9 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", packet_length=94, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1806
            #17 0x0000560fe1e5375d in do_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:1360
            #18 0x0000560fe1fa18e7 in do_handle_one_connection (connect=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1335
            #19 0x0000560fe1fa1667 in handle_one_connection (arg=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1241
            #20 0x0000560fe22ff01a in pfs_spawn_thread (arg=0x560fe3f68908) at /10.2/storage/perfschema/pfs.cc:1862
            #21 0x00007fb68a3c06ba in start_thread (arg=0x7fb684257700) at pthread_create.c:333
            #22 0x00007fb68985541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
            {noformat}
            {code:sql}
            CREATE TABLE t1 (i1 int, a int);
            INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);

            CREATE TABLE t2 (i2 int);
            INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);

            SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
            FROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t;
            {code}

            {noformat}
            #3 <signal handler called>
            #4 0x0000560fe20e66c1 in Item_field::used_tables (this=0x7fb66817e350) at /10.2/sql/item.cc:2876
            #5 0x0000560fe21a378e in Item_sum::update_used_tables (this=0x7fb668179870) at /10.2/sql/item_sum.cc:546
            #6 0x0000560fe21a2be6 in Item_sum::check_sum_func (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_sum.cc:312
            #7 0x0000560fe22b8018 in Item_sum_hybrid_simple::fix_fields (this=0x7fb668179870, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:273
            #8 0x0000560fe22b77eb in Item_window_func::fix_fields (this=0x7fb66817e470, thd=0x7fb668000a98, ref=0x7fb668111580) at /10.2/sql/item_windowfunc.cc:102
            #9 0x0000560fe1df2065 in setup_fields (thd=0x7fb668000a98, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fb668062400, pre_fix=0x7fb668004ee0, allow_sum_func=true) at /10.2/sql/sql_base.cc:7058
            #10 0x0000560fe1e98b4a in JOIN::prepare (this=0x7fb6680620b0, tables_init=0x7fb6681842b0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fb668004d90, unit_arg=0x7fb668004638) at /10.2/sql/sql_select.cc:806
            #11 0x0000560fe1ea3080 in mysql_select (thd=0x7fb668000a98, tables=0x7fb6681842b0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fb668179e50, unit=0x7fb668004638, select_lex=0x7fb668004d90) at /10.2/sql/sql_select.cc:3713
            #12 0x0000560fe1e9783b in handle_select (thd=0x7fb668000a98, lex=0x7fb668004570, result=0x7fb668179e50, setup_tables_done_option=0) at /10.2/sql/sql_select.cc:373
            #13 0x0000560fe1e637e4 in execute_sqlcom_select (thd=0x7fb668000a98, all_tables=0x7fb6681842b0) at /10.2/sql/sql_parse.cc:6456
            #14 0x0000560fe1e59562 in mysql_execute_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:3467
            #15 0x0000560fe1e67158 in mysql_parse (thd=0x7fb668000a98, rawbuf=0x7fb66806aa10 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", length=94, parser_state=0x7fb6842561f0, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7898
            #16 0x0000560fe1e54e01 in dispatch_command (command=COM_QUERY, thd=0x7fb668000a98, packet=0x7fb668007fe9 "SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1)\nFROM (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) t", packet_length=94, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1806
            #17 0x0000560fe1e5375d in do_command (thd=0x7fb668000a98) at /10.2/sql/sql_parse.cc:1360
            #18 0x0000560fe1fa18e7 in do_handle_one_connection (connect=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1335
            #19 0x0000560fe1fa1667 in handle_one_connection (arg=0x560fe4008d48) at /10.2/sql/sql_connect.cc:1241
            #20 0x0000560fe22ff01a in pfs_spawn_thread (arg=0x560fe3f68908) at /10.2/storage/perfschema/pfs.cc:1862
            #21 0x00007fb68a3c06ba in start_thread (arg=0x7fb684257700) at pthread_create.c:333
            #22 0x00007fb68985541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
            {noformat}
            varun Varun Gupta (Inactive) made changes -
            Summary server crashed after incorrect use of NTH_VALUE() server crashed with NTH_VALUE()
            varun Varun Gupta (Inactive) added a comment - - edited

            This example posted by alice above

            create table t1 (a int);
            insert into t1 values (1), (2), (3);
            select lead(max(a) over (partition by a)) over (order by a)  from t1 group by a;
            

            We should throw an error here, because by standard for window function, its arguments cannot have a window function.
            The same is the case with the second example:

            select ntile(5) over(), 
              last_value(std(0) over(w2 partition by a)) 
              over(order by a) 
             from t window w1 as (w2 order by a);
            

            Have opened a separate issue for these 2 cases as we should report an error here. The issue is
            MDEV-22984

            varun Varun Gupta (Inactive) added a comment - - edited This example posted by alice above create table t1 (a int ); insert into t1 values (1), (2), (3); select lead( max (a) over (partition by a)) over ( order by a) from t1 group by a; We should throw an error here, because by standard for window function, its arguments cannot have a window function. The same is the case with the second example: select ntile(5) over(), last_value(std(0) over(w2 partition by a)) over( order by a) from t window w1 as (w2 order by a); Have opened a separate issue for these 2 cases as we should report an error here. The issue is MDEV-22984
            varun Varun Gupta (Inactive) added a comment - Patch https://github.com/mariadb/server/commit/d527daa499d26e61cbc96b6a11a8d4281de1f6a3
            varun Varun Gupta (Inactive) made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            varun Varun Gupta (Inactive) made changes -
            Assignee Varun Gupta [ varun ] Sergei Petrunia [ psergey ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            Ok to push.

            psergei Sergei Petrunia added a comment - Ok to push.
            psergei Sergei Petrunia made changes -
            Assignee Sergei Petrunia [ psergey ] Varun Gupta [ varun ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            varun Varun Gupta (Inactive) made changes -
            Fix Version/s 10.2.33 [ 24307 ]
            Fix Version/s 10.3.24 [ 24306 ]
            Fix Version/s 10.4.14 [ 24305 ]
            Fix Version/s 10.5.5 [ 24423 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            dbart Daniel Bartholomew made changes -
            Fix Version/s 10.2.34 [ 24505 ]
            Fix Version/s 10.3.25 [ 24506 ]
            Fix Version/s 10.4.15 [ 24507 ]
            Fix Version/s 10.5.6 [ 24508 ]
            Fix Version/s 10.4.14 [ 24305 ]
            Fix Version/s 10.3.24 [ 24306 ]
            Fix Version/s 10.2.33 [ 24307 ]
            Fix Version/s 10.5.5 [ 24423 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.5.7 [ 25019 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.5.6 [ 24508 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.4.16 [ 25020 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.4.15 [ 24507 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.3.26 [ 25021 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.3.25 [ 24506 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.2.35 [ 25022 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.2.34 [ 24505 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 85384 ] MariaDB v4 [ 153720 ]

            People

              varun Varun Gupta (Inactive)
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.