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

CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the sequence, causes ER_KEY_NOT_FOUND

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.3(EOL)
    • 10.3.6
    • Sequences
    • b8c92d752c34e51dbe8ed551542415e2481581d7 and earlier

    Description

      CREATE SEQUENCE seq1;
      LOCK TABLE seq1 WRITE;
       
      CREATE OR REPLACE SEQUENCE seq1;
      UNLOCK TABLES;
       
      SELECT NEXTVAL(seq1);
       
      # Cleanup
      DROP SEQUENCE seq1;
      

      Strange behavior starts at CREATE OR REPLACE SEQUENCE, it ends with an unexpected error ER_TABLE_NOT_LOCKED:

      MariaDB [test]> CREATE OR REPLACE SEQUENCE seq1;
      ERROR 1100 (HY000): Table 'seq1' was not locked with LOCK TABLES
      MariaDB [test]> UNLOCK TABLES;
      Query OK, 0 rows affected (0.00 sec)
      

      Further attempts to use the sequence cause ER_KEY_NOT_FOUND:

      MariaDB [test]> SELECT NEXTVAL(seq1);
      ERROR 1032 (HY000): Can't find record in 'seq1'
      

      Attachments

        Activity

          People

            monty Michael Widenius
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.