[MDEV-15251] Error message should show altered table name for failing check constraint Created: 2018-02-08  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.3.4, 10.2, 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Ralf Gebhardt Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When a check constraint is added to a table where existing data violates the constraint, the resulting error message includes the table name of the temporary table created by alter, instead of the name of the altered table.

MariaDB [test]> create table t1 (id int);
Query OK, 0 rows affected (0.010 sec)
 
MariaDB [test]> insert into t1 values (1),(10);
Query OK, 2 rows affected (0.001 sec)
Records: 2  Duplicates: 0  Warnings: 0
 
MariaDB [test]> alter table t1 add constraint chk_id check (id<10);
ERROR 4025 (23000): CONSTRAINT `chk_id` failed for `test`.`#sql-51e_1d`


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