Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22805

SIGSEGV in check_fields on UPDATE (optimized builds) | Assertion `thd->lex->sql_command == SQLCOM_UPDATE' failed.

    XMLWordPrintable

Details

    Description

      USE test;
      CREATE TABLE t(id INT);
      UPDATE t FOR PORTION OF APPTIME FROM (SELECT s FROM t LIMIT 1) TO h() SET t.id=t.id + 5;
      

      Leads to:

      10.5.4 701efbb25b738f0c971798c5234d4d66b9235e47

      Core was generated by `/test/MD030620-mariadb-10.5.4-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x1487b054e700 (LWP 2742089))]
      (gdb) bt
      (gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055c4a62e8647 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
      #2  0x000055c4a5caaf4a in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  check_fields (thd=thd@entry=0x14878c012018, table=table@entry=0x14878c049f50, items=@0x14878c0167c0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14878c04aa38, last = 0x14878c04aa38, elements = 1}, <No data fields>}, update_view=<optimized out>) at /test/10.5_opt/sql/sql_update.cc:197
      #5  0x000055c4a5b5e818 in Multiupdate_prelocking_strategy::handle_end (this=0x1487b054cef0, thd=0x14878c012018) at /test/10.5_opt/sql/sql_update.cc:1712
      #6  0x000055c4a5b62a89 in mysql_multi_update_prepare (thd=thd@entry=0x14878c012018) at /test/10.5_opt/sql/sql_update.cc:1850
      #7  0x000055c4a5ab4448 in mysql_execute_command (thd=thd@entry=0x14878c012018) at /test/10.5_opt/sql/sql_parse.cc:4439
      #8  0x000055c4a5abbf1c in mysql_parse (thd=0x14878c012018, rawbuf=<optimized out>, length=87, parser_state=0x1487b054d4b0, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:7992
      #9  0x000055c4a5ab1235 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14878c012018, packet=packet@entry=0x14878c03a019 "UPDATE t FOR PORTION OF APPTIME FROM (SELECT s FROM t LIMIT 1) TO h() SET t.id=t.id + 5", packet_length=packet_length@entry=87, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1874
      #10 0x000055c4a5aaf644 in do_command (thd=0x14878c012018) at /test/10.5_opt/sql/sql_parse.cc:1355
      #11 0x000055c4a5ba47c1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x1487ae0329b8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1411
      #12 0x000055c4a5ba4b24 in handle_one_connection (arg=arg@entry=0x1487ae0329b8) at /test/10.5_opt/sql/sql_connect.cc:1313
      #13 0x000055c4a5f1117a in pfs_spawn_thread (arg=0x1487ae04b018) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #14 0x00001487af9756db in start_thread (arg=0x1487b054e700) at pthread_create.c:463
      #15 0x00001487aed7388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg), 10.5.4 (opt)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      MariaDB 10.3.24 (opt):

      10.3.24 ecc7f305dde85d704a37e584c29df0ed3f97f7be

      10.3.24>UPDATE t FOR PORTION OF APPTIME FROM (SELECT s FROM t LIMIT 1) TO h() SET t.id=t.id + 5;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FOR PORTION OF APPTIME FROM (SELECT s FROM t LIMIT 1) TO h() SET t.id=t.id + 5' at line 1
      

      Attachments

        Activity

          People

            shulga Dmitry Shulga
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.