提交 efd2d768 编写于 作者: B Benguang Zhao

fix: Uniqueness checking of names of columns and tags

上级 24ba7548
......@@ -1632,7 +1632,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
}
// field name must be unique
if (has(pFieldList, i + 1, pField->name) == true) {
if (has(pFieldList, i, pField->name) == true) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
return false;
}
......@@ -1691,7 +1691,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
return false;
}
if (has(pTagsList, i + 1, p->name) == true) {
if (has(pTagsList, i, p->name) == true) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
return false;
}
......@@ -1720,8 +1720,8 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
// field name must be unique
for (int32_t i = 0; i < numOfTags; ++i) {
TAOS_FIELD* p = taosArrayGet(pTagsList, i);
if (has(pFieldList, 0, p->name) == true) {
size_t numOfCols = taosArrayGetSize(pFieldList);
if (has(pFieldList, numOfCols, p->name) == true) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
return false;
}
......@@ -1867,9 +1867,8 @@ int32_t validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
}
/* is contained in pFieldList or not */
static bool has(SArray* pFieldList, int32_t startIdx, const char* name) {
size_t numOfCols = taosArrayGetSize(pFieldList);
for (int32_t j = startIdx; j < numOfCols; ++j) {
static bool has(SArray* pFieldList, int32_t endIdx, const char* name) {
for (int32_t j = 0; j < endIdx; ++j) {
TAOS_FIELD* field = taosArrayGet(pFieldList, j);
if (strncmp(name, field->name, sizeof(field->name) - 1) == 0) return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册