[MDEV-18278] Misleading error message in error log upon failed table creation Created: 2019-01-17  Updated: 2021-10-20  Resolved: 2021-10-11

Status: Closed
Project: MariaDB Server
Component/s: Server, Virtual Columns
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.41, 10.3.32, 10.4.22, 10.5.13, 10.6.5

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: affects-tests

Issue Links:
Duplicate
is duplicated by MDEV-26262 frm is reported corrupted after ER_EX... Closed
Relates
relates to MDEV-15962 Column-level CHECK constraint on time... Open

 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.



 Comments   
Comment by Elena Stepanova [ 2019-07-26 ]

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'

Comment by Elena Stepanova [ 2020-05-16 ]

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.

Comment by Oleksandr Byelkin [ 2021-10-01 ]

midenok What to review???

Comment by Aleksey Midenkov [ 2021-10-05 ]

Sorry, please review bb-10.2-midenok2

Comment by Oleksandr Byelkin [ 2021-10-07 ]

OK to push

Generated at Thu Feb 08 08:42:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.