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

Read only server throws error when running a create temporary table as select statement

Details

    Description

      Read only MariaDB server throws error when running a create temporary table as select statement. The error

      ERROR 1290 (HY000): The MariaDB server is running with the --read-only option so it cannot execute this statement
      

      is thrown. In version 10.5.24 the temporary table gets created but it is not populated any data. In version 10.6.17 and version 11.3.2 the temporary table gets created and is populated with data.
      As far as I understand, this statement should be allowed on a read-only server, can we find a way to no longer throw this error.

      Steps to reproduce

      -- Log in as a super user
      set global read_only=ON;
      use test;
      create table test_tbl(a int);
      create user test_user@localhost identified by 'NotSecure';
      grant insert, select, update, delete, create temporary tables on test.* to test_user@localhost;
      insert into test_tbl select * from seq_1_to_5;
      -- Log in as the limited privledge user mariadb -u test_user -pNotSecure test
      create temporary table tmp_test_tbl as select * from test_tbl;  -- error will be thrown here
      select * from tmp_test_tbl; -- 10.6 & higher return results 10.5 has an empty table
      create temporary table tmp_test_tbl2 like test_tbl;   -- This succeeds with no error
      insert into tmp_test_tbl2 select * from test_tbl -- This succeeds with no error
      select * from tmp_test_tbl2; -- This returns data 
      

      Attachments

        Activity

          This is a consequence of MDEV-12068. DDLs on temporary tables are written into a binary log, and binary log write fails under read-only.

          As a workaround, you can either disable binary logging or switch to the binlog_format=ROW.

          The proper fix will be in MDEV-12068

          serg Sergei Golubchik added a comment - This is a consequence of MDEV-12068 . DDLs on temporary tables are written into a binary log, and binary log write fails under read-only. As a workaround, you can either disable binary logging or switch to the binlog_format=ROW. The proper fix will be in MDEV-12068
          kyle.hutchinson Kyle Hutchinson added a comment - - edited

          serg I have seen this behavior even with binlog_format=ROW. Plus, not all DDL is throwing the error only specifically the create temporary table ... as select ... statement. A standard create temporary table... and a create temporary table tmp_test_tbl2 like test_tbl execute with no errors thrown. I may be totally wrong, but this leads me to think that something has been done to resolve the issue, but perhaps create temporary table ... as select ... statement was accidentally missed.

          kyle.hutchinson Kyle Hutchinson added a comment - - edited serg I have seen this behavior even with binlog_format=ROW. Plus, not all DDL is throwing the error only specifically the create temporary table ... as select ... statement. A standard create temporary table... and a create temporary table tmp_test_tbl2 like test_tbl execute with no errors thrown. I may be totally wrong, but this leads me to think that something has been done to resolve the issue, but perhaps create temporary table ... as select ... statement was accidentally missed.

          okay, sorry, my first comment was incorrect then, it's not because of binlog. it was a bug in partitioning (sic!), will fix

          serg Sergei Golubchik added a comment - okay, sorry, my first comment was incorrect then, it's not because of binlog. it was a bug in partitioning (sic!), will fix

          People

            serg Sergei Golubchik
            kyle.hutchinson Kyle Hutchinson
            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.