Skip to content

Commit

Permalink
bugfix: TIME_FORMAT() should be ok in stored generated columns
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Sep 18, 2017
1 parent 3e5cdfa commit c4dc2b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result
Expand Up @@ -2924,3 +2924,18 @@ a b
2001-01-01 02:03:04 02.03.04
drop table t1;
set sql_warnings = 0;
# TIME_FORMAT() STORED
set sql_warnings = 1;
create table t1 (a datetime, b varchar(10) as (time_format(a,"%H.%i.%S")) STORED);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
`b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%H.%i.%S')) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('2001-01-01 02:03:04',default);
select * from t1;
a b
2001-01-01 02:03:04 02.03.04
drop table t1;
set sql_warnings = 0;
6 changes: 6 additions & 0 deletions mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc
Expand Up @@ -1209,3 +1209,9 @@ let $values1 = '2001-01-01 02:03:04',default;
let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc

--echo # TIME_FORMAT() STORED
let $cols = a datetime, b varchar(10) as (time_format(a,"%H.%i.%S")) STORED;
let $values1 = '2001-01-01 02:03:04',default;
let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc

2 changes: 2 additions & 0 deletions sql/item_timefunc.h
Expand Up @@ -832,6 +832,8 @@ class Item_func_date_format :public Item_str_func
bool eq(const Item *item, bool binary_cmp) const;
bool check_vcol_func_processor(void *arg)
{
if (is_time_format)
return false;
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
Expand Down

0 comments on commit c4dc2b8

Please sign in to comment.