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

Client warning and log error about FK inconsistency are logically mixed up

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • 5.5, 10.1, 10.2, 10.3, 10.4
    • N/A
    • None

    Description

      Consider the following scenario:

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (f INT, UNIQUE(f), KEY(f), FOREIGN KEY (f) REFERENCES t1 (f)) ENGINE=InnoDB;
      SET SESSION FOREIGN_KEY_CHECKS= OFF;
      ALTER TABLE t1 DROP KEY f;
       
      --source include/restart_mysqld.inc
       
      --error ER_NO_SUCH_TABLE_IN_ENGINE,ER_NO_SUCH_TABLE
      SELECT * FROM t1;
      SHOW WARNINGS;
      SET SESSION FOREIGN_KEY_CHECKS= OFF;
      SELECT * FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      The first SELECT when FOREIGN_KEY_CHECKS=ON, fails:

      MariaDB [test]> SELECT * FROM t1;
      ERROR 1932 (42S02): Table 'test.t1' doesn't exist in engine
      MariaDB [test]> SHOW WARNINGS;
      +-------+------+-----------------------------------------+
      | Level | Code | Message                                 |
      +-------+------+-----------------------------------------+
      | Error | 1932 | Table 'test.t1' doesn't exist in engine |
      +-------+------+-----------------------------------------+
      1 row in set (0.000 sec)
      

      And at the same time produces the warning in the error log:

      2019-05-20 16:01:55 9 [Warning] InnoDB: Load table `test`.`t1` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.
      

      It should be the other way round: the message explaining the nature of the problem and suggesting the solution should be the error shown to the user, especially since it only requires a session-level change; while the error about table not existing in the engine is a fairly low-level product which doesn't anyhow help the user, it should go to the error log (if anywhere at all).

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              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.