未验证 提交 80644cdf 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #9098 from taosdata/fix/TD-12014

[TD-12014]<fix>: taosshell crash when apply arithmetic operation with select now
...@@ -4694,6 +4694,11 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr, ...@@ -4694,6 +4694,11 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr,
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
//now allowing now +/- value in select expr
if (pExpr->tokenId == TK_TIMESTAMP) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
if (pExpr->type == SQL_NODE_VALUE) { if (pExpr->type == SQL_NODE_VALUE) {
*type = SQLEXPR_TYPE_VALUE; *type = SQLEXPR_TYPE_VALUE;
} }
......
...@@ -660,6 +660,19 @@ sql select c2-c2 from $tb ...@@ -660,6 +660,19 @@ sql select c2-c2 from $tb
sql select first(c1)-last(c1), spread(c2), max(c3) - min(c3), avg(c4)*count(c4) from $tb sql select first(c1)-last(c1), spread(c2), max(c3) - min(c3), avg(c4)*count(c4) from $tb
# arithmetic operation with now [d.21]===============================================================
sql_error select now from $tb
sql_error select now + 123 from $tb
sql_error select 123 + now from $tb
sql_error select now - 123 from $tb
sql_error select 123 - now from $tb
sql_error select now * 123 from $tb
sql_error select 123 * now from $tb
sql_error select now / 123 from $tb
sql_error select 123 / now from $tb
sql_error select now % 123 from $tb
sql_error select 123 % now from $tb
sql_error select 12 * now / 12 + 12 - 12 * 12 from $tb
#====================================================super table query================================================== #====================================================super table query==================================================
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册