mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-16630: Ambiguous error message when check constraint matches table name
One can create table with the same name for `field` and `table` `check` constraint. For example: `create table t(a int check(a>0), constraint a check(a>10));` But when inserting new rows same error is always raised. For example with ```insert into t values (-1);``` and ```insert into t values (10);``` same error `ER_CONSTRAINT_FAILED` is obtained and it is not clear which constraint is violated. This patch solve this error so that in case if field constraint is violated the first parameter in the error message is `table.field_name` and if table constraint is violated the first parameter in error message is `constraint_name`.
This commit is contained in:
committed by
Vicențiu-Marian Ciorbaru
parent
b71c9ae030
commit
8639e28808
@ -7,7 +7,7 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (0);
|
||||
ERROR 23000: CONSTRAINT `a` failed for `test`.`t1`
|
||||
ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1`
|
||||
drop table t1;
|
||||
create table t1 (a int, b int, check (a>b));
|
||||
show create table t1;
|
||||
|
Reference in New Issue
Block a user