提交 c6fb6c36 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Correct return type of TIMESTAMPADD

上级 f8f7bd97
......@@ -3673,10 +3673,9 @@ Use negative values to subtract units.
addIntLong may be a long value when manipulating milliseconds,
otherwise it's range is restricted to int.
The same units as in the EXTRACT function are supported.
DATEADD method returns a value with the same type as specified value if unit is compatible with this value.
This method returns a value with the same type as specified value if unit is compatible with this value.
If specified unit is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP.
Units DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values.
TIMESTAMPADD method returns a long.
","
DATEADD('MONTH', 1, DATE '2001-01-31')
"
......
......@@ -346,7 +346,7 @@ public class Function extends Expression implements FunctionCall {
addFunction("DATEADD", DATE_ADD,
3, Value.TIMESTAMP);
addFunction("TIMESTAMPADD", DATE_ADD,
3, Value.LONG);
3, Value.TIMESTAMP);
addFunction("DATEDIFF", DATE_DIFF,
3, Value.LONG);
addFunction("TIMESTAMPDIFF", DATE_DIFF,
......
......@@ -125,3 +125,9 @@ SELECT DATEADD('DAY', 10, TIMESTAMP WITH TIME ZONE '2000-01-05 15:00:30.12345678
> -----------------------------------------------------------
> 2000-01-15 15:00:30.123456789-10
> rows: 1
SELECT TIMESTAMPADD('DAY', 10, TIMESTAMP '2000-01-05 15:00:30.123456789');
> TIMESTAMP '2000-01-15 15:00:30.123456789'
> -----------------------------------------
> 2000-01-15 15:00:30.123456789
> rows: 1
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论