[MDEV-413] No warning is produced on microsecond precision truncation, as it is done for other data types Created: 2012-07-27 Updated: 2014-06-06 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.25, 5.3.7 |
| Fix Version/s: | 5.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When a value with microseconds is truncated while being inserted into a time column, it does not cause a warning, as it happens in the similar situation with other data types: Microseconds truncated, no warning:
Fractional part of a decimal value truncated, a warning is produced:
It might cause a confusion, especially if a user does not expect that the server knows about microseconds and takes them into account:
The empty result set is understandable considering that TIME is actually TIME(0), and that the inserted value is silently truncated, while in the select the string literal is converted into a temporal value with microseconds; but it is not obvious at all without a warning about truncation. |
| Comments |
| Comment by Elena Stepanova [ 2012-07-27 ] | ||||||||||||
|
If this problem gets fixed, we will need to re-run 'engines' suite (it is not a part of the default set), and update result files accordingly. | ||||||||||||
| Comment by Sergei Golubchik [ 2012-08-06 ] | ||||||||||||
|
Elena, please test this bugfix | ||||||||||||
| Comment by Elena Stepanova [ 2012-08-06 ] | ||||||||||||
|
From IRC (for my reference): <serg> I've committed a patch. besides this issue it also makes temporal warnings more close to other types, e.g. assigning invalid value will produce | ||||||||||||
| Comment by Elena Stepanova [ 2012-08-07 ] | ||||||||||||
|
5.5-serg revno 3458 Two warnings (a note and a warning) are produced together, looks like a bit of overkill: create table t1 (a time);
INSERT INTO t1 VALUES('-850:00:00');
show warnings;
I'd expect one or another (on maria-5.5 it's only 1264, it's probably more precise). | ||||||||||||
| Comment by Elena Stepanova [ 2012-08-07 ] | ||||||||||||
|
5.5-serg revno 3458 create table t (a timestamp(3));
insert into t values ('2012-12-31 23:59:59.101999999999999999');
show warnings;
| ||||||||||||
| Comment by Elena Stepanova [ 2012-08-15 ] | ||||||||||||
|
Some inconsistency in the type of the warning (hard to say if it's a regression, since in maria/5.5 one of the warnings was missing at all, which is what this bug was initially about): create table t1 (f1 time(1), f6 time(6)); insert into t1 values ('-838:59:59.999999','-838:59:59.999999');
show warnings;
update t1 set f1=f6;
show warnings;
That is, the same value in the first case causes 1265, while in the second case 1264. | ||||||||||||
| Comment by Elena Stepanova [ 2012-08-16 ] | ||||||||||||
|
Sergei, As discussed, I've put observations related to this bugfix as comments above, and filed as separate reports whatever unrelated I encountered while digging (mostly trivia). Nothing serious about the bugfix either, but it would be nice to get rid of the duplicate warnings described in the first 2 comments while we still can – if they creep into the tree, they're going to stay there forever.. |