[MDEV-14576] Include full name of object in message about incorrect value for column Created: 2017-12-05  Updated: 2020-08-25  Resolved: 2018-12-18

Status: Closed
Project: MariaDB Server
Component/s: Server
Fix Version/s: 10.2.20

Type: Task Priority: Critical
Reporter: Geoff Montee (Inactive) Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: error


 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';



 Comments   
Comment by Alexey Botchkov [ 2018-11-04 ]

http://lists.askmonty.org/pipermail/commits/2018-November/013056.html

Comment by Alexey Botchkov [ 2018-11-12 ]

I didn't include modified test results in this patch to make it smaller.
http://lists.askmonty.org/pipermail/commits/2018-November/013083.html

Here is an example of tests that change with this patch:
http://lists.askmonty.org/pipermail/commits/2018-November/013084.html

Comment by Marko Mäkelä [ 2018-12-18 ]

holyfoot, I think that this should be closed as fixed, now that this is in the 10.2, 10.3, and 10.4 branches.
Before closing, maybe you would fix the omission that I noticed in int select_export::send_data(List<Item> &items) (and add a test to cover the message)?

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