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

sequences used as default by other table not dumped in right order by mysqldump

    XMLWordPrintable

    Details

      Description

      mysqldump treads sequences the same as other tables, dumping all of them in alphabetical order. A sequence may provide the default value for a column on another table though. So if the table name alphabetically comes before the sequence name, the tables CREATE statement will be in the dump output before the CREATE for the sequence table, and so the table creation will fail as it refers to a sequence not created yet.

      How to reproduce:

      • create sequence and table:

      CREATE SEQUENCE b;
      CREATE TABLE a (id INT PRIMARY KEY DEFAULT (NEXT VALUE FOR b));
      

      • dump database with mysqldump, then restore into an empty database
      • restore will fail when trying to create table `a`:

      ERROR 1146 (42S02) at line ...: Table 'test.b' doesn't exist

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated: