Bug #18248 error messages issued with STRICT_ALL_TABLES are sometimes misleading

Submitted: 15 Mar 2006 7:38 Modified: 23 Mar 2006 17:08
Reporter: Giuseppe Maxia Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.0.19, 5.1.7 OS:Any (all)
Assigned to: CPU Architecture:Any

[15 Mar 2006 7:38] Giuseppe Maxia
Description:
when working under STRICT_ALL_TABLE sql mode, the database engine correctly rejects wrong values, but it still gives error messages as if they were warnings.
If I get a message saying "data truncated", I may assume that the data was inserted with a wrong value. Instead, the data was not inserted (correctly), but the message is wrong.

How to repeat:
create table emp(name varchar(30), gender enum('M','F')) engine=myisam;
set sql_mode=strict_all_tables;
insert into emp values ('a','a');
ERROR 1265 (01000): Data truncated for column 'gender' at row 1

create table person(name varchar(30), colors SET('R','Y','B')) engine=myisam;
insert into person values ('A','A');
ERROR 1265 (01000): Data truncated for column 'colors' at row 1

Suggested fix:
Change the message so that it shows what the DBMS is doing, the same that is happening for dates. If I insert '2006-02-31' in a DATE column under STRICT_ALL_TABLE SQL mode, I get 
"ERROR 1292 (22007): Incorrect date value: '2006-02-31' for column 'd' at row 1", which is what I would expect.
Error messages for wrong ENUM or SET values should say that the data was rejected, rather than truncated.
[23 Mar 2006 17:08] Valeriy Kravchuk
Thank you for a reasonable feature request.
[24 Apr 2007 22:13] Philip Stoev
Please see Bug #28079 for another error message like that and a possible solution involving simple re-phrasing on existing error messages.

I also believe that the category for this bug is wrong, I must be "Server: Errors".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.