mirror of
https://github.com/MariaDB/server.git
synced 2025-07-02 14:22:51 +03:00
Side effect: the second debug Note in cache_temporal_4265.result disappeared. Before this change: - During JOIN::cache_const_exprs(), Item::get_cache() for Item_date_add_interval() was called. The data type for date_add('2001-01-01',interval 5 day) is VARCHAR, because the first argument is VARCHAR (not temporal). Item_get_cache() created Item_cache_str('2001-01-06'). - During evaluate_join_record(), get_datetime_value() was called, which called Item::get_date() for Item_cache_str('2001-01-06'). This gave the second Note. Then, get_datetime_value() created a new cache, now Item_cache_temporal for '2001-01-06', so not further str_to_datetime() happened. After this change: - During tem_bool_rowready_func2::fix_length_and_dec(), Arg_comparator::set_cmp_func_datetime() is called, which immediately creates an instance of Item_cache_date for the result of date_add('2001-01-01',interval 5 day). So later no str_to_datetime happens any more, neither during JOIN::cache_const_exprs(), nor during evaluate_join_record().
24 lines
717 B
Plaintext
24 lines
717 B
Plaintext
create table t1 (a date);
|
|
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
|
|
set debug_dbug='d,str_to_datetime_warn';
|
|
select * from t1 where a > date_add('2000-01-01', interval 5 day);
|
|
a
|
|
2001-02-03
|
|
2002-03-04
|
|
Warnings:
|
|
Note 1003 2000-01-01
|
|
set debug_dbug='';
|
|
drop table t1;
|
|
create table t1 (id int not null, ut timestamp(6) not null);
|
|
insert into t1 values(1, '2001-01-01 00:00:00.2');
|
|
insert into t1 values(1, '2001-01-01 00:00:00.1');
|
|
select * from t1;
|
|
id ut
|
|
1 2001-01-01 00:00:00.200000
|
|
1 2001-01-01 00:00:00.100000
|
|
select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1;
|
|
(select max(m2.ut) from t1 m2 where m1.id <> 0)
|
|
2001-01-01 00:00:00.200000
|
|
2001-01-01 00:00:00.200000
|
|
drop table t1;
|