Merge pull request #27557 from taosdata/fix/TS-5340
fix: validate to_iso8601 parameters
This commit is contained in:
commit
e1079f3704
|
@ -2426,8 +2426,12 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
|
|||
|
||||
// param1
|
||||
if (numOfParams == 2) {
|
||||
SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1);
|
||||
|
||||
SNode* pNode = (SNode*)nodesListGetNode(pFunc->pParameterList, 1);
|
||||
if (QUERY_NODE_VALUE != nodeType(pNode)) {
|
||||
return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Not supported timzone format");
|
||||
}
|
||||
|
||||
SValueNode* pValue = (SValueNode*)pNode;
|
||||
if (!validateTimezoneFormat(pValue)) {
|
||||
return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid timzone format");
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ class TDTestCase:
|
|||
err_param = [1.5,'a','c2']
|
||||
for i in err_param:
|
||||
tdSql.error(f"select to_iso8601({i}) from db.ntb")
|
||||
tdSql.error(f"select to_iso8601(ts, timezone()) from db.stb")
|
||||
tdSql.query("select to_iso8601(now) from db.stb")
|
||||
tdSql.checkRows(3)
|
||||
tdSql.query("select to_iso8601(now()) from db.stb")
|
||||
|
|
Loading…
Reference in New Issue