fix: udf error check

This commit is contained in:
Xiaoyu Wang 2023-03-22 19:09:26 +08:00
parent a0a51187bf
commit fddf3f16cf
1 changed files with 6 additions and 4 deletions

View File

@ -6396,14 +6396,16 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FUNCTION_NAME);
}
if (TSDB_DATA_TYPE_JSON == pStmt->outputDt.type ||
TSDB_DATA_TYPE_VARBINARY == pStmt->outputDt.type ||
TSDB_DATA_TYPE_DECIMAL == pStmt->outputDt.type ||
TSDB_DATA_TYPE_BLOB == pStmt->outputDt.type ||
if (TSDB_DATA_TYPE_JSON == pStmt->outputDt.type || TSDB_DATA_TYPE_VARBINARY == pStmt->outputDt.type ||
TSDB_DATA_TYPE_DECIMAL == pStmt->outputDt.type || TSDB_DATA_TYPE_BLOB == pStmt->outputDt.type ||
TSDB_DATA_TYPE_MEDIUMBLOB == pStmt->outputDt.type) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Unsupported output type for UDF");
}
if (!pStmt->isAgg && pStmt->bufSize > 0) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "BUFSIZE can only be used with UDAF");
}
SCreateFuncReq req = {0};
strcpy(req.name, pStmt->funcName);
req.igExists = pStmt->ignoreExists;