add error
This commit is contained in:
parent
9f0d6eddae
commit
69e402d547
|
@ -1901,20 +1901,30 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea
|
|||
if (!checkColumnName(pCxt, pColName)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT);
|
||||
CHECK_OUT_OF_MEM(pStmt);
|
||||
pStmt->alterType = alterType;
|
||||
COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName);
|
||||
pStmt->dataType = dataType;
|
||||
pStmt->pColOptions = (SColumnOptions*)pOptions;
|
||||
|
||||
// if pOptions is NULL, it means that the column has no options
|
||||
if (pOptions != NULL) {
|
||||
SColumnOptions* pOption = (SColumnOptions*)pOptions;
|
||||
if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) {
|
||||
pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION;
|
||||
if (pOption->bPrimaryKey == false || pOption->commentNull == true) {
|
||||
if (strlen(pOption->compress) != 0 || strlen(pOption->compressLevel) || strlen(pOption->encode) != 0) {
|
||||
pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION;
|
||||
} else {
|
||||
pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR,
|
||||
"not support alter column with option except compress");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
pCxt->errCode = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR,
|
||||
"not support alter column with option except compress");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
pStmt->pColOptions = (SColumnOptions*)pOptions;
|
||||
return createAlterTableStmtFinalize(pRealTable, pStmt);
|
||||
}
|
||||
|
||||
|
|
|
@ -12899,8 +12899,10 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S
|
|||
pReq->bytes = calcTypeBytes(pStmt->dataType);
|
||||
if (pStmt->pColOptions != NULL) {
|
||||
if (!checkColumnEncodeOrSetDefault(pReq->type, pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||
if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress)) return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR;
|
||||
if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel)) return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||
if (!checkColumnCompressOrSetDefault(pReq->type, pStmt->pColOptions->compress))
|
||||
return TSDB_CODE_TSC_COMPRESS_PARAM_ERROR;
|
||||
if (!checkColumnLevelOrSetDefault(pReq->type, pStmt->pColOptions->compressLevel))
|
||||
return TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR;
|
||||
int8_t code = setColCompressByOption(pReq->type, columnEncodeVal(pStmt->pColOptions->encode),
|
||||
columnCompressVal(pStmt->pColOptions->compress),
|
||||
columnLevelVal(pStmt->pColOptions->compressLevel), true, &pReq->compress);
|
||||
|
|
Loading…
Reference in New Issue