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

Server crashes in handle_if_exists_options upon adding check constraint to temporary table

    XMLWordPrintable

    Details

      Description

      It is somewhat different both from MDEV-16788 (no stored procedures but temporary table is needed), so I'm filing it separately. It is likely though that a fix for one of them will affect the other, so please check both. MDEV-17818 can also be related.

      CREATE TEMPORARY TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP, b DATETIME ON UPDATE CURRENT_TIMESTAMP, c INT);
      ALTER TABLE t1 ADD CONSTRAINT CHECK (c > 0);
      --error ER_BAD_FIELD_ERROR
      ALTER TABLE t1 CHANGE COLUMN x xx CHAR;
      ALTER TABLE t1 ADD CONSTRAINT CHECK (c <= 10);
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 e837a358

      #3  <signal handler called>
      #4  0x000055a2a1be4c09 in handle_if_exists_options (thd=0x7f4798000af0, table=0x7f479800a5a0, alter_info=0x7f47e12c6c30, period_info=0x7f47e12c6e98) at /data/src/10.4/sql/sql_table.cc:6495
      #5  0x000055a2a1bedfe2 in mysql_alter_table (thd=0x7f4798000af0, new_db=0x7f47980052b0, new_name=0x7f47980056b8, create_info=0x7f47e12c6cf0, table_list=0x7f47980132a0, alter_info=0x7f47e12c6c30, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9722
      #6  0x000055a2a1c87023 in Sql_cmd_alter_table::execute (this=0x7f4798013d90, thd=0x7f4798000af0) at /data/src/10.4/sql/sql_alter.cc:508
      #7  0x000055a2a1b05795 in mysql_execute_command (thd=0x7f4798000af0) at /data/src/10.4/sql/sql_parse.cc:6101
      #8  0x000055a2a1b0ae57 in mysql_parse (thd=0x7f4798000af0, rawbuf=0x7f4798013198 "ALTER TABLE t1 ADD CONSTRAINT CHECK (c <= 10)", length=45, parser_state=0x7f47e12c8160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
      #9  0x000055a2a1af603a in dispatch_command (command=COM_QUERY, thd=0x7f4798000af0, packet=0x7f47981371f1 "ALTER TABLE t1 ADD CONSTRAINT CHECK (c <= 10)", packet_length=45, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #10 0x000055a2a1af46c7 in do_command (thd=0x7f4798000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #11 0x000055a2a1c7d933 in do_handle_one_connection (connect=0x55a2a5df9240) at /data/src/10.4/sql/sql_connect.cc:1412
      #12 0x000055a2a1c7d682 in handle_one_connection (arg=0x55a2a5df9240) at /data/src/10.4/sql/sql_connect.cc:1316
      #13 0x000055a2a2684575 in pfs_spawn_thread (arg=0x55a2a5d63850) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #14 0x00007f47e9ea84a4 in start_thread (arg=0x7f47e12c9700) at pthread_create.c:456
      #15 0x00007f47e7fdcd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.2-10.5, all of non-debug, debug and ASAN builds, with at least InnoDB, MyISAM and Aria.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: