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

Package-wide TYPE variable declarations fail during mariadb-dump restore

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 13.1
    • N/A
    • Stored routines
    • None
    • Not for Release Notes
    • Q3/2026 Server Maintenance

    Description

      Currently, the restore fails because procedure creation statements appear before package creation statements in the backup file

      --------------
      CREATE DEFINER="root"@"localhost" PROCEDURE "p1"()
      AS
        r pkg1.rec0_t;
      BEGIN r.a:=1; SELECT r.a; END
      --------------
       
      ERROR 4161 (HY000) at line 27 in file: 'backup.sql': Unknown data type: '`pkg1`.`rec0_t`'
      Query OK, 0 rows affected (0.000 sec)
      

      MTR Test

      SET sql_mode=ORACLE;
       
      DELIMITER $$;
      CREATE PACKAGE pkg1 AS
        TYPE rec0_t IS RECORD (a INT, b VARCHAR(30));
      END;
      $$
      CREATE PROCEDURE p1 AS
        r pkg1.rec0_t;
      BEGIN r.a:=1; SELECT r.a; END;
      $$
      DELIMITER ;$$
       
      --exec $MYSQL_DUMP --skip-comments --routines --databases test > $MYSQLTEST_VARDIR/tmp/i2.sql
      DROP DATABASE test;
      CREATE DATABASE test;
      # Default reload aborts at p1 (dumped before pkg1) -> exit 1, nothing restored
      --error 1
      --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/i2.sql 2>&1
      USE test;
      # both procedure and package missing
      SELECT routine_name FROM information_schema.routines WHERE routine_schema='test';
      --remove_file $MYSQLTEST_VARDIR/tmp/i2.sql
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1d
                  1d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 6.5h Time Not Required
                  6.5h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.