Error Code: 3814. An expression of a check constraint 'chk_dataNasc' contains disallowed function: curdate. code example

Example: ERROR 3814 (HY000): An expression of a check constraint 'INV_CK1' contains disallowed function: `TO_DATE`.

mysql> CREATE TABLE t1 (c1 INTEGER CHECK (c1 > 0));
Query OK, 0 rows affected (0.04 sec)
 
mysql> SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.01 sec)
 
-- CHECK constraint search condition is not evaluated.
mysql> INSERT INTO t1 VALUES (0);
Query OK, 1 row affected (0.00 sec)

Tags:

Sql Example