提交 49efb4ae 编写于 作者: K kailixu

fix: modify column length for super table

上级 e493a30a
...@@ -1578,9 +1578,11 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO ...@@ -1578,9 +1578,11 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
return -1; return -1;
} }
col_id_t colId = pOld->pColumns[col].colId;
uint32_t nLen = 0; uint32_t nLen = 0;
for (int32_t i = 0; i < pOld->numOfColumns; ++i) { for (int32_t i = 0; i < pOld->numOfColumns; ++i) {
nLen += (pOld->pColumns[i].colId == col) ? pField->bytes : pOld->pColumns[i].bytes; nLen += (pOld->pColumns[i].colId == colId) ? pField->bytes : pOld->pColumns[i].bytes;
} }
if (nLen > TSDB_MAX_BYTES_PER_ROW) { if (nLen > TSDB_MAX_BYTES_PER_ROW) {
...@@ -1588,7 +1590,6 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO ...@@ -1588,7 +1590,6 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
return -1; return -1;
} }
col_id_t colId = pOld->pColumns[col].colId;
if (mndCheckColAndTagModifiable(pMnode, pOld->name, pOld->uid, colId) != 0) { if (mndCheckColAndTagModifiable(pMnode, pOld->name, pOld->uid, colId) != 0) {
return -1; return -1;
} }
......
...@@ -671,6 +671,12 @@ sql alter table tb2023 add column v nchar(16379); ...@@ -671,6 +671,12 @@ sql alter table tb2023 add column v nchar(16379);
sql_error alter table tb2023 modify column v nchar(16380); sql_error alter table tb2023 modify column v nchar(16380);
sql desc tb2023 sql desc tb2023
print =============== modify column for normal table
sql create table ntb_ts3841(ts timestamp, c0 varchar(64000));
sql alter table ntb_ts3841 modify column c0 varchar(64001);
sql create table ntb1_ts3841(ts timestamp, c0 nchar(15000));
sql alter table ntb1_ts3841 modify column c0 nchar(15001);
print =============== error for super table print =============== error for super table
sql create table stb2023(ts timestamp, f int) tags(t1 int); sql create table stb2023(ts timestamp, f int) tags(t1 int);
sql_error alter table stb2023 add column v varchar(65518); sql_error alter table stb2023 add column v varchar(65518);
...@@ -685,6 +691,20 @@ sql alter table stb2023 add column v nchar(16379); ...@@ -685,6 +691,20 @@ sql alter table stb2023 add column v nchar(16379);
sql_error alter table stb2023 modify column v nchar(16380); sql_error alter table stb2023 modify column v nchar(16380);
sql desc stb2023 sql desc stb2023
print =============== modify column/tag for super table
sql create table stb_ts3841(ts timestamp, c0 varchar(64000)) tags(t1 binary(16380));
sql alter table stb_ts3841 modify column c0 varchar(64001);
sql alter table stb_ts3841 modify tag t1 binary(16381);
sql alter table stb_ts3841 modify tag t1 binary(16382);
sql_error alter table stb_ts3841 modify tag t1 binary(16383);
sql create table stb1_ts3841(ts timestamp, c0 nchar(15000)) tags(t1 nchar(4093));
sql alter table stb1_ts3841 modify column c0 nchar(15001);
sql alter table stb1_ts3841 modify tag t1 nchar(4094);
sql alter table stb1_ts3841 modify tag t1 nchar(4095);
sql_error alter table stb1_ts3841 modify tag t1 nchar(4096);
sql_error alter table stb1_ts3841 modify tag t1 binary(16382);
print ======= over print ======= over
sql drop database d1 sql drop database d1
sql select * from information_schema.ins_databases sql select * from information_schema.ins_databases
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册