Commit d32c4314 authored by unknown's avatar unknown

Fix bug #12298 Typo in timestampdiff() function name results in erroneous

view being created.

Item_func_timestamp_diff::func_name() were returning function name as
"timestamp_diff" thus when view was executed function parameters wasn't 
properly recognized and error was raised.


mysql-test/r/func_time.result:
  Fix test result after bugfix #12298
sql/item_timefunc.h:
  Fix bug #12298 Typo in timestampdiff() function name results in wrong view being created.
mysql-test/t/view.test:
  Test case for bug #12298 Typo in timestampdiff()  function name results in erroneous view being created.
mysql-test/r/view.result:
  Test case for bug #12298 Typo in timestampdiff() function name results in erroneous view being created.
parent 6161e197
......@@ -687,7 +687,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
Note 1003 select timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
select last_day('2005-00-00');
last_day('2005-00-00')
NULL
......
......@@ -2092,3 +2092,8 @@ SELECT a FROM v1;
a
DROP VIEW v1;
DROP TABLE t1,t2,t3,t4,t5;
create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:00:00') as f1;
select * from v1;
f1
1
drop view v1;
......@@ -1936,4 +1936,9 @@ SELECT a FROM v1;
DROP VIEW v1;
DROP TABLE t1,t2,t3,t4,t5;
#
# Bug #12298 Typo in function name results in erroneous view being created.
#
create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:00:00') as f1;
select * from v1;
drop view v1;
......@@ -860,7 +860,7 @@ class Item_func_timestamp_diff :public Item_int_func
public:
Item_func_timestamp_diff(Item *a,Item *b,interval_type type_arg)
:Item_int_func(a,b), int_type(type_arg) {}
const char *func_name() const { return "timestamp_diff"; }
const char *func_name() const { return "timestampdiff"; }
longlong val_int();
void fix_length_and_dec()
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment