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

Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES upon attempt to create existing table

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (a INT);
      LOCK TABLE t1 WRITE;
      CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, e DATE, PERIOD FOR app(s,e));
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 c24ec3ce

      mysqld: /data/src/10.4/sql/sql_error.cc:335: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed.
      191108 19:59:17 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc54ddd7f12 in __GI___assert_fail (assertion=0x561293cbc620 "!is_set() || (m_status == DA_OK_BULK && is_bulk_op())", file=0x561293cbc568 "/data/src/10.4/sql/sql_error.cc", line=335, function=0x561293cbc960 <Diagnostics_area::set_ok_status(unsigned long long, unsigned long long, char const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:101
      #8  0x0000561292f7af48 in Diagnostics_area::set_ok_status (this=0x7fc5340064c0, affected_rows=0, last_insert_id=0, message=0x0) at /data/src/10.4/sql/sql_error.cc:335
      #9  0x0000561292f1f17e in my_ok (thd=0x7fc534000af0, affected_rows_arg=0, id=0, message=0x0) at /data/src/10.4/sql/sql_class.h:5009
      #10 0x00005612930c6bac in Sql_cmd_create_table_like::execute (this=0x7fc534013278, thd=0x7fc534000af0) at /data/src/10.4/sql/sql_table.cc:11446
      #11 0x0000561292fd9466 in mysql_execute_command (thd=0x7fc534000af0) at /data/src/10.4/sql/sql_parse.cc:6099
      #12 0x0000561292fdeb29 in mysql_parse (thd=0x7fc534000af0, rawbuf=0x7fc534013138 "CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, e DATE, PERIOD FOR app(s,e))", length=109, parser_state=0x7fc543f68170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7898
      #13 0x0000561292fc9d06 in dispatch_command (command=COM_QUERY, thd=0x7fc534000af0, packet=0x7fc534008341 "CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, e DATE, PERIOD FOR app(s,e))", packet_length=109, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #14 0x0000561292fc8393 in do_command (thd=0x7fc534000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #15 0x000056129315025b in do_handle_one_connection (connect=0x561296950e60) at /data/src/10.4/sql/sql_connect.cc:1412
      #16 0x000056129314ffaa in handle_one_connection (arg=0x561296950e60) at /data/src/10.4/sql/sql_connect.cc:1316
      #17 0x0000561293b53b15 in pfs_spawn_thread (arg=0x5612968756c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #18 0x00007fc54f94d4a4 in start_thread (arg=0x7fc543f69700) at pthread_create.c:456
      #19 0x00007fc54de94d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4, 10.5. The test case is not applicable to previous versions, although it's possible that the problem isn't limited to application periods.

      Non-debug version doesn't crash, it only produces the error:

      mysqltest: At line 3: query 'CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, e DATE, PERIOD FOR app(s,e))' failed: 4155: Period field `s` cannot be GENERATED ALWAYS AS
      

      The error itself isn't wrong, however the question is whether CREATE should even go that far, given that the table already exists.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rucha174 Rucha Deodhar
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: