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

CREATE TEMPORARY TABLE ... SELECT syntax fails on read-only replica

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.5.8
    • N/A
    • Replication
    • None

    Description

      We have recently undergone a migration of our app from MySQL 5.6 to MariaDB 10.5.8, and encountered the following change in behaviour between the two.

      On MariaDB 10.5.8, the following fails:

      Create a table on primary:

      CREATE TABLE test (
        id int(10),
        stock_level int(10),
        PRIMARY KEY (id)
      );
       
      INSERT INTO test (id, stock_level) VALUES (1, 2);
      

      On read-only replica, the following fails:

      CREATE TEMPORARY TABLE temp_test_fails (
        id int(10),
        stock_level int(10),
        PRIMARY KEY (id)
      )
      SELECT
        id,
        stock_level
      FROM
        test
      ;
      

      The error message is "The MariaDB server is running with the --read-only option so it cannot execute this statement". It does still seem to create the temporary table, but doesn't insert any data.

      However, those statements will run if they are split up:

      CREATE TEMPORARY TABLE temp_test_ok (
        id int(10),
        stock_level int(10),
        PRIMARY KEY (id)
      );
       
      INSERT INTO temp_test_ok SELECT id, stock_level FROM test;
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ross.motley Ross Motley
              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.