diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 1a03eae716ff1ee5109e69461b94af6b79734f8e..8dcff251912e48ad77fb7e7aff1d88f03736a10f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1823,7 +1823,6 @@ int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) { int32_t validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) { const char* msg1 = "too many columns"; - const char* msg3 = "column length too long"; const char* msg4 = "invalid data type"; const char* msg5 = "invalid column name or length"; const char* msg6 = "invalid column length"; @@ -1863,9 +1862,11 @@ int32_t validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) { } // length less than TSDB_MAX_BYTES_PER_ROW - if (nLen + pColField->bytes + (IS_VAR_DATA_TYPE(pColField->type) ? sizeof(VarDataOffsetT) : 0) > - TSDB_MAX_BYTES_PER_ROW) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); + int32_t totalLength = nLen + pColField->bytes + (IS_VAR_DATA_TYPE(pColField->type) ? sizeof(VarDataOffsetT) : 0); + if (totalLength > TSDB_MAX_BYTES_PER_ROW) { + char errMsg[64]; + sprintf(errMsg, "(%d > %d)", totalLength, TSDB_MAX_BYTES_PER_ROW); + return tscErrorMsgWithCode(TSDB_CODE_TSC_EXCEED_ROW_BYTES, tscGetErrorMsgPayload(pCmd), errMsg, NULL); } // field name must be unique diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index f8080ca6e5d15833997f4387788fccfa00368e21..ce71ab963c9a2dabf1fa367360f9550f8cfc84e8 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -120,6 +120,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TSC_INVALID_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0228) //"invalid table schema version") #define TSDB_CODE_TSC_TOO_MANY_SML_LINES TAOS_DEF_ERROR_CODE(0, 0x0229) //"too many lines in batch") #define TSDB_CODE_TSC_SEND_DATA_FAILED TAOS_DEF_ERROR_CODE(0, 0x0230) //"Client send request data error" +#define TSDB_CODE_TSC_EXCEED_ROW_BYTES TAOS_DEF_ERROR_CODE(0, 0x0231) //"Columns total length exceeds row bytes // mnode #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed" diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 4852fe653f3890c4c73123d33ceba627987fcf14..3768e2124df91704fbc3e2be1b3845ffdc103d09 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -127,6 +127,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_PRECISION_TYPE, "Invalid timestamp pre TAOS_DEFINE_ERROR(TSDB_CODE_TSC_RES_TOO_MANY, "Result set too large to be output") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_TOO_MANY_SML_LINES, "Too many lines in batch") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_SEND_DATA_FAILED, "Client send request data failed") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_EXCEED_ROW_BYTES, "Columns total length exceeds row bytes") // mnode TAOS_DEFINE_ERROR(TSDB_CODE_MND_MSG_NOT_PROCESSED, "Message not processed")