[MDEV-24046] Invalid SQL state for error 1366 Created: 2020-10-28 Updated: 2020-11-07 Resolved: 2020-11-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.4.13 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Kamil Tekiela | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 10 |
||
| Description |
|
When trying to insert an incorrect value into for example integer field an error is throw with code 1366. According to https://mariadb.com/kb/en/mariadb-error-codes/ and MySQL 8 the SQL status should be HY000 (General issue), however for MariaDB it is showing 22007 which is slightly misleading and not compatible with MySQL.
In MySQL this produces:
and in MariaDB:
|
| Comments |
| Comment by Sergei Golubchik [ 2020-11-07 ] |
|
Error ER_TRUNCATED_WRONG_VALUE — 1292 — has SQLSTATE 22007 both in MariaDB and MySQL. It looks correct that ER_TRUNCATED_WRONG_VALUE_FOR_FIELD — 1366 — has the same SQLSTATE. In fact, 22007 isn't the best SQLSTATE for them, 22007 is "invalid datetime format", some more generic value, like 22005 "error in assignment" would be more appropriate. But both errors surely should have the same SQLSTATE and in MySQL they don't |