diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5fcca10e18..d776972d01 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -446,7 +446,6 @@ typedef struct SField { uint8_t type; int8_t flags; int32_t bytes; - int8_t is_pk; } SField; typedef struct SRetention { @@ -524,7 +523,6 @@ struct SSchema { int8_t flags; col_id_t colId; int32_t bytes; - int8_t is_pk; char name[TSDB_COL_NAME_LEN]; }; @@ -582,6 +580,7 @@ void tFreeSSubmitRsp(SSubmitRsp* pRsp); #define COL_SMA_ON ((int8_t)0x1) #define COL_IDX_ON ((int8_t)0x2) +#define COL_IS_KEY ((int8_t)0x4) #define COL_SET_NULL ((int8_t)0x10) #define COL_SET_VAL ((int8_t)0x20) #define COL_IS_SYSINFO ((int8_t)0x40) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 285f21f4b1..f9b0d8d216 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5695,11 +5695,14 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { SNode* pNode; FOREACH(pNode, pList) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; - SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType), .is_pk = pCol->is_pk}; + SField field = {.type = pCol->dataType.type, .bytes = calcTypeBytes(pCol->dataType)}; strcpy(field.name, pCol->colName); if (pCol->sma) { field.flags |= COL_SMA_ON; } + if (pCol->is_pk) { + field.flags != COL_IS_KEY; + } taosArrayPush(*pArray, &field); } return TSDB_CODE_SUCCESS; @@ -6079,11 +6082,13 @@ static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchem if (pCol->sma) { flags |= COL_SMA_ON; } + if (pCol->is_pk) { + flags != COL_IS_KEY; + } pSchema->colId = colId; pSchema->type = pCol->dataType.type; pSchema->bytes = calcTypeBytes(pCol->dataType); pSchema->flags = flags; - pSchema->is_pk = pCol->is_pk; strcpy(pSchema->name, pCol->colName); }