add stream check

This commit is contained in:
54liuyao 2024-04-10 13:54:27 +08:00
parent bd16bd12c3
commit 4137c71909
1 changed files with 12 additions and 2 deletions

View File

@ -8161,6 +8161,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC
} }
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
bool hasTsKey = false;
bool hasPrimaryKey = false; bool hasPrimaryKey = false;
SNode* pCol = NULL; SNode* pCol = NULL;
SNode* pProj = NULL; SNode* pProj = NULL;
@ -8176,13 +8177,22 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC
break; break;
} }
if (PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { if (PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) {
hasTsKey = true;
}
if (pSchema->flags & COL_IS_KEY) {
hasPrimaryKey = true; hasPrimaryKey = true;
} }
} }
if (TSDB_CODE_SUCCESS == code && !hasPrimaryKey) { if (TSDB_CODE_SUCCESS == code && !hasTsKey) {
code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM, code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM,
"primary timestamp column can not be null"); "Primary timestamp column of dest table can not be null");
}
if (TSDB_CODE_SUCCESS == code && !hasPrimaryKey && hasPkInTable(pMeta)) {
code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM,
"Primary key column of dest table can not be null");
} }
SNodeList* pNewProjections = NULL; SNodeList* pNewProjections = NULL;