Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
None
Description
This script:
create or replace table t1(dt datetime); |
insert into t1 values ('2017-05-17'); |
select max(dt) over (order by dt rows between 1 following and 1 following) from t1; |
show warnings;
|
returns a correct result:
+----------------------------------------------------------------------+
|
| max(dt) over (order by dt rows between 1 following and 1 following) |
|
+----------------------------------------------------------------------+
|
| NULL |
|
+----------------------------------------------------------------------+
|
but causes a redundant warning in bb-10.2-ext and 10.3:
+---------+------+------------------------------+
|
| Level | Code | Message |
|
+---------+------+------------------------------+
|
| Warning | 1292 | Incorrect datetime value: '' |
|
+---------+------+------------------------------+
|
The warning looks wrong. There should not be any warnings.
The problem is not repeatable in 10.2.
The problem happens because Item_window_func::save_in_field() works differently in bb-10.2-ext comparing to 10.2:
- 10.2 goes through val_str()
- bb-10.2-ext goes through get_date(), due to Type_handler related changes
After a discussion with Vicentiu, it was decided to fix Item_window_func::val_xxx() to return NULL (instead of an "empty" value, such as 0 for numbers and '' for strings) when force_return_blank is set.