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

mysqldump --tables --routines generates non importable dump file

Details

    Description

      When exporting some views and routines together (to separate manually and automatically managed parts of a schema) with `mysqldump ... --routines --tabels table1 table2 ...` I noticed that the generated dump-file is not importable again, because the routines are ordered after all the tables/ views and thus views that use them cannot be imported.

      I have attached a test dump that I generated that shows this problem.

      Workaround: Using negative logic and instead listing all the tables/views to skip seems to not trigger this bug.

      Attachments

        Issue Links

          Activity

            Oh by the way: in this file I attached, the views do not use the routines, but im my production db they do. Sorry if this has created confusion.

            dwt Martin Häcker added a comment - Oh by the way: in this file I attached, the views do not use the routines, but im my production db they do. Sorry if this has created confusion.

            Thanks for the report. Reproducible on all versions of MariaDB (5.5-10.3) and MySQL (5.5-8.0).

            CREATE FUNCTION f() RETURNS INT RETURN 1;
            CREATE VIEW v1 AS SELECT f();
             
            --exec $MYSQL_DUMP -uroot test --routines --tables v1 > $MYSQLTEST_VARDIR/test.dmp
             
            DROP VIEW v1;
            DROP FUNCTION f;
             
            --exec $MYSQL -uroot test < $MYSQLTEST_VARDIR/test.dmp
             
            # Cleanup
            DROP VIEW v1;
            DROP FUNCTION f;
            

            ERROR 1305 (42000) at line 43: FUNCTION test.f does not exist
            mysqltest: At line 9: exec of '/data/bld/10.3/bin/mysql --defaults-file=/data/bld/10.3/mysql-test/var/my.cnf -uroot test < /data/bld/10.3/mysql-test/var/test.dmp' failed, error: 256, status: 1, errno: 11
            

            elenst Elena Stepanova added a comment - Thanks for the report. Reproducible on all versions of MariaDB (5.5-10.3) and MySQL (5.5-8.0). CREATE FUNCTION f() RETURNS INT RETURN 1; CREATE VIEW v1 AS SELECT f();   --exec $MYSQL_DUMP -uroot test --routines --tables v1 > $MYSQLTEST_VARDIR/test.dmp   DROP VIEW v1; DROP FUNCTION f;   --exec $MYSQL -uroot test < $MYSQLTEST_VARDIR/test.dmp   # Cleanup DROP VIEW v1; DROP FUNCTION f; ERROR 1305 (42000) at line 43: FUNCTION test.f does not exist mysqltest: At line 9: exec of '/data/bld/10.3/bin/mysql --defaults-file=/data/bld/10.3/mysql-test/var/my.cnf -uroot test < /data/bld/10.3/mysql-test/var/test.dmp' failed, error: 256, status: 1, errno: 11
            cvicentiu Vicențiu Ciorbaru added a comment - Fixed with 1d43f71c7b4c39a6fd196c104b5ebafb65376199

            People

              rutuja Rutuja Surve (Inactive)
              dwt Martin Häcker
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.