From 9f0d6eddaeade9cbc9ea2b1d11f57fe514999d53 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Fri, 31 May 2024 09:34:41 +0000 Subject: [PATCH] add error --- source/libs/parser/src/parAstCreater.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 86ce93d920..13c74ca881 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1907,8 +1907,12 @@ SNode* createAlterTableAddModifyColOptions2(SAstCreateContext* pCxt, SNode* pRea COPY_STRING_FORM_ID_TOKEN(pStmt->colName, pColName); pStmt->dataType = dataType; + // if pOptions is NULL, it means that the column has no options if (pOptions != NULL) { - pStmt->alterType = TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION; + 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; + } } pStmt->pColOptions = (SColumnOptions*)pOptions; return createAlterTableStmtFinalize(pRealTable, pStmt);