Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
When a value isn't compatible with a column, the user sees an error message like the following:
MariaDB [db1]> DELETE FROM tab1 WHERE col1='abcd';
|
ERROR 1366 (22007): Incorrect decimal value: 'abcd' for column 'col1' at row 1
|
It would be helpful if this error message also named the database and table, since a statement can affect multiple tables (such as when stored procedures, triggers, and views are involved), and multiple tables can have a column with the same name.
For example, run the following SQL:
CREATE TABLE tab1 (
|
col1 char(10) NOT NULL
|
);
|
|
CREATE TABLE tab1_tgr (
|
col1 decimal(8,0) NOT NULL
|
);
|
|
DELIMITER //
|
|
CREATE TRIGGER delete_tab1_tgr BEFORE DELETE ON tab1 FOR EACH ROW
|
BEGIN
|
INSERT INTO tab1_tgr (col1) VALUES (old.col1);
|
END //
|
|
DELIMITER ;
|
|
INSERT INTO tab1 VALUES ('abcd');
|
DELETE FROM tab1 WHERE col1='abcd';
|