feature(udf): implement drop function
This commit is contained in:
parent
86af1c7f8d
commit
c5ef299434
|
@ -3127,6 +3127,13 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* pStmt) {
|
||||||
|
SDropFuncReq req = {0};
|
||||||
|
strcpy(req.name, pStmt->funcName);
|
||||||
|
req.igNotExists = pStmt->ignoreNotExists;
|
||||||
|
return buildCmdMsg(pCxt, TDMT_MND_DROP_FUNC, (FSerializeFunc)tSerializeSDropFuncReq, &req);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) {
|
static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) {
|
||||||
SAlterUserReq req = {0};
|
SAlterUserReq req = {0};
|
||||||
if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) ||
|
if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) ||
|
||||||
|
@ -3266,6 +3273,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
|
||||||
case QUERY_NODE_CREATE_FUNCTION_STMT:
|
case QUERY_NODE_CREATE_FUNCTION_STMT:
|
||||||
code = translateCreateFunction(pCxt, (SCreateFunctionStmt*)pNode);
|
code = translateCreateFunction(pCxt, (SCreateFunctionStmt*)pNode);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_DROP_FUNCTION_STMT:
|
||||||
|
code = translateDropFunction(pCxt, (SDropFunctionStmt*)pNode);
|
||||||
|
break;
|
||||||
case QUERY_NODE_GRANT_STMT:
|
case QUERY_NODE_GRANT_STMT:
|
||||||
code = translateGrant(pCxt, (SGrantStmt*)pNode);
|
code = translateGrant(pCxt, (SGrantStmt*)pNode);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -93,6 +93,18 @@ endi
|
||||||
if $data00 != 2.645751311 then
|
if $data00 != 2.645751311 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
#sql drop function udf1;
|
sql drop function udf1;
|
||||||
#sql drop function udf2;
|
sql show functions;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != @udf2@ then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql drop function udf2;
|
||||||
|
sql show functions;
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGTERM
|
system sh/exec.sh -n dnode1 -s stop -x SIGTERM
|
||||||
|
|
Loading…
Reference in New Issue