提交 9a5402b0 编写于 作者: L lichuang

[TD-5324]<fix>:check max row bytes when alter tag/column width

上级 411a035c
......@@ -6006,6 +6006,16 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidOperationMsg(pMsg, msg22);
}
SSchema* pSchema = (SSchema*) pTableMetaInfo->pTableMeta->schema;
int16_t numOfColumns = pTableMetaInfo->pTableMeta->tableInfo.numOfColumns;
int16_t i;
uint32_t nLen = 0;
for (i = 0; i < numOfColumns; ++i) {
nLen += pSchema[i].colId != columnIndex.columnIndex ? pSchema[i].bytes : pItem->bytes;
}
if (nLen >= TSDB_MAX_BYTES_PER_ROW) {
return invalidOperationMsg(pMsg, msg24);
}
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
}else if (pAlterSQL->type == TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN) {
......@@ -6047,6 +6057,17 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidOperationMsg(pMsg, msg22);
}
SSchema* pSchema = (SSchema*) pTableMetaInfo->pTableMeta->schema;
int16_t numOfColumns = pTableMetaInfo->pTableMeta->tableInfo.numOfColumns;
int16_t i;
uint32_t nLen = 0;
for (i = 0; i < numOfColumns; ++i) {
nLen += pSchema[i].colId != columnIndex.columnIndex ? pSchema[i].bytes : pItem->bytes;
}
if (nLen >= TSDB_MAX_BYTES_PER_ROW) {
return invalidOperationMsg(pMsg, msg24);
}
TAOS_FIELD f = tscCreateField(pColSchema->type, name.z, pItem->bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册