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

last_insert_id and insert_id are always zero in mysql.slow_log

    XMLWordPrintable

    Details

      Description

      I can't find any signs that it had ever worked in the past, either in MariaDB or in upstream. So, possibly it's just a documentation issue, as from the KB article it looks like it's supposed to work.

      set @output.save= @@global.log_output;
      set global log_output='TABLE';
       
      set long_query_time=0.00001;
      create table t1 (a int auto_increment primary key);
      insert into t1 values (null),(null),(null);
      select last_insert_id();
      insert into t1 values (null),(null),(null);
      select last_insert_id();
      select last_insert_id, insert_id, sql_text from mysql.slow_log;
       
      drop table t1;
      set global log_output= @output.save;
      

      10.5 1b12e251

      insert into t1 values (null),(null),(null);
      select last_insert_id();
      last_insert_id()
      1
      insert into t1 values (null),(null),(null);
      select last_insert_id();
      last_insert_id()
      4
      select last_insert_id, insert_id, sql_text from mysql.slow_log;
      last_insert_id	insert_id	sql_text
      0	0	set long_query_time=0.00001
      0	0	create table t1 (a int auto_increment primary key)
      0	0	insert into t1 values (null),(null),(null)
      0	0	select last_insert_id()
      0	0	insert into t1 values (null),(null),(null)
      0	0	select last_insert_id()
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: