提交 bb2b2ec9 编写于 作者: S shenglian zhou

[TD-5594]<fix>:calculate tag index in table meta when modify tag type

上级 1d3df4a9
......@@ -6078,10 +6078,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta);
int16_t numOfTags = tscGetNumOfTags(pTableMetaInfo->pTableMeta);
int16_t i;
int32_t numOfCols = tscGetNumOfColumns(pTableMetaInfo->pTableMeta);
int32_t tagIndex = columnIndex.columnIndex - numOfCols;
assert(tagIndex>=0);
uint32_t nLen = 0;
for (i = 0; i < numOfTags; ++i) {
nLen += (i != columnIndex.columnIndex) ? pSchema[i].bytes : pItem->bytes;
for (int i = 0; i < numOfTags; ++i) {
nLen += (i != tagIndex) ? pSchema[i].bytes : pItem->bytes;
}
if (nLen >= TSDB_MAX_TAGS_LEN) {
return invalidOperationMsg(pMsg, msg24);
......
......@@ -35,7 +35,10 @@ sql alter table tb1 set tag name = ""
sql alter table tb1 set tag name = "shenzhen"
sql alter table tb1 set tag len = 379
# case TD-5594
sql create stable st5520(ts timestamp, f int) tags(t0 bool, t1 nchar(4093), t2 nchar(1))
sql_error alter stable st5520 modify tag t2 nchar(2);
# test end
sql drop database $db
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册