[MDEV-30306] FR: sql_mode to throw errors instead of warnings on DECIMAL truncating rounding Created: 2022-12-27 Updated: 2023-11-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Hartmut Holzgraefe | Assignee: | Ralf Gebhardt |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When assigning a value with more decimals than a DECIMAL column was created for a 1265 | Data truncated for column 'val' at row 1 warning is raised.There has been a request whether an error could be raised instead. We looked into solving this using triggers or a check constraint, but apparently rounding already happens before trigger or check condition code is executed, so this approach does not seem to work. Hence this feature request for some sort of "NO_DECIMAL_TRUNCATION" sql_mode |
| Comments |
| Comment by Hari Hara Naveen S [ 2022-12-30 ] |
|
I am interested on this feature request, any advice on which files I should look into? |
| Comment by Sergei Golubchik [ 2023-01-04 ] |
|
The current behavior is what the standard requires us to do:
|
| Comment by Daniel Black [ 2023-07-06 ] |
|
HHN, take a look at the WARN_DATA_TRUNCATED warning in sql/field.cc, sql/field_conv.cc and sql/sql_class.cc |