Skip to content

Commit 0a76ad5

Browse files
committed
MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work
1 parent a90da6e commit 0a76ad5

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

mysql-test/r/second_frac-9175.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
2+
timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456')
3+
31622400123456
4+
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
5+
id select_type table type possible_keys key key_len ref rows filtered Extra
6+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
7+
Warnings:
8+
Note 1003 select timestampdiff(MICROSECOND,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') AS `timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456')`
9+
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
10+
select * from v1;
11+
Name_exp_1
12+
31622400123456
13+
drop view v1;

mysql-test/t/second_frac-9175.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work
3+
#
4+
5+
select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
6+
explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
7+
create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
8+
select * from v1;
9+
drop view v1;

sql/item_timefunc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,7 +2916,7 @@ void Item_func_timestamp_diff::print(String *str, enum_query_type query_type)
29162916
str->append(STRING_WITH_LEN("SECOND"));
29172917
break;
29182918
case INTERVAL_MICROSECOND:
2919-
str->append(STRING_WITH_LEN("SECOND_FRAC"));
2919+
str->append(STRING_WITH_LEN("MICROSECOND"));
29202920
break;
29212921
default:
29222922
break;

0 commit comments

Comments
 (0)