Bug #113176 Unexpected errors caused by check constraints
Submitted: 22 Nov 2023 7:22 Modified: 22 Nov 2023 7:42
Reporter: Chenglin Tian Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.1.0, 8.0.35 OS:Ubuntu
Assigned to: CPU Architecture:x86

[22 Nov 2023 7:22] Chenglin Tian
Description:
Hello, we randomly generated some SQL statements during database testing. Our table creation statement triggered an error in the check constraint part. The error showed that our constraints were associated with data in other columns, but our constraints did not It is not related to other columns, it is just a conditional expression. Is this a bug or a problem with incorrect error information?

How to repeat:
CREATE TABLE t0(c0 DECIMAL  UNIQUE KEY DEFAULT 0.2921954450911477 CHECK((((NULL) NOT IN (NULL)) IS FALSE) IS NOT FALSE) , c1 DECIMAL  UNIQUE PRIMARY KEY NOT NULL) ;
actual: error:Column check constraint 't0_chk_1' references other column
expected: execution succeed

Suggested fix:
We believe that the check constraint in our table creation statement complies with the grammatical specifications. Even if you think this constraint is meaningless, it finally returned a Boolean value and we did not reference other columns. We think we should not Get an error message like this
[22 Nov 2023 7:42] MySQL Verification Team
Hello Chenglin Tian,

Thank you for the report.

regards,
Umesh