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

Misleading error message in error log upon failed table creation

Details

    Description

      Execution of

      CREATE TABLE t1 (a INT AS (a)) ENGINE=InnoDB;
      

      expectedly fails, in 10.2+ with

      ERROR 4029 (01000): Expression for field `a` is refering to uninitialized field `a`
      

      and no table is created.
      However, an error is written to the error log

      2019-01-17  2:01:21 140595305703168 [ERROR] mysqld: Incorrect information in file: './test/t1.frm'
      

      The error is unnecessary alarming, as it suggests database corruption.

      I don't suppose there should be any error in the log at all, since no harm is done, it's just a regular failed attempt to create a table. But if we do want to write in in the error log on whatever reason, let it be the same ER_EXPRESSION_REFERS_TO_UNINIT_FIELD as returned to the user.

      Attachments

        Issue Links

          Activity

            Also, test cases from MDEV-15962 produce such an error, and so does this one with ALTER (note the temporary table in the message):

            CREATE  TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
            ALTER TABLE t1 ADD b INT CHECK (a IS NOT NULL) FIRST;
             
            # Cleanup
            DROP TABLE t1;
            

            mysqltest: At line 2: query 'ALTER TABLE t1 ADD b INT CHECK (a IS NOT NULL) FIRST' failed: 4029: Expression for field `b` is referring to uninitialized field `a`
             
            2019-07-26 13:18:09 140255070500608 [ERROR] mysqld: Incorrect information in file: './test/#sql-5538_4.frm'
            

            elenst Elena Stepanova added a comment - Also, test cases from MDEV-15962 produce such an error, and so does this one with ALTER (note the temporary table in the message): CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); ALTER TABLE t1 ADD b INT CHECK (a IS NOT NULL ) FIRST ;   # Cleanup DROP TABLE t1; mysqltest: At line 2: query 'ALTER TABLE t1 ADD b INT CHECK (a IS NOT NULL) FIRST' failed: 4029: Expression for field `b` is referring to uninitialized field `a`   2019-07-26 13:18:09 140255070500608 [ERROR] mysqld: Incorrect information in file: './test/#sql-5538_4.frm'
            elenst Elena Stepanova added a comment - - edited

            Raising the priority, because it may hide serious problems from testing – it is impossible from the error log to distinguish real corruption from the fake one.
            Removed virtual columns from components, because the test case from the comment doesn't use them.

            elenst Elena Stepanova added a comment - - edited Raising the priority, because it may hide serious problems from testing – it is impossible from the error log to distinguish real corruption from the fake one. Removed virtual columns from components, because the test case from the comment doesn't use them.

            midenok What to review???

            sanja Oleksandr Byelkin added a comment - midenok What to review???

            Sorry, please review bb-10.2-midenok2

            midenok Aleksey Midenkov added a comment - Sorry, please review bb-10.2-midenok2

            OK to push

            sanja Oleksandr Byelkin added a comment - OK to push

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.