Merge pull request #3990 from taosdata/bugfix/TD-1653
[TD-1653]<fix>: wrong error message when data type in an insert statement is invalid
This commit is contained in:
commit
c7b01b4568
|
@ -877,22 +877,13 @@ static bool validateTableColumnInfo(tFieldList* pFieldList, SSqlCmd* pCmd) {
|
||||||
|
|
||||||
int32_t nLen = 0;
|
int32_t nLen = 0;
|
||||||
for (int32_t i = 0; i < pFieldList->nField; ++i) {
|
for (int32_t i = 0; i < pFieldList->nField; ++i) {
|
||||||
if (pFieldList->p[i].bytes == 0) {
|
TAOS_FIELD* pField = &pFieldList->p[i];
|
||||||
|
|
||||||
|
if (pField->bytes == 0) {
|
||||||
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5);
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg5);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nLen += pFieldList->p[i].bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// max row length must be less than TSDB_MAX_BYTES_PER_ROW
|
|
||||||
if (nLen > TSDB_MAX_BYTES_PER_ROW) {
|
|
||||||
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// field name must be unique
|
|
||||||
for (int32_t i = 0; i < pFieldList->nField; ++i) {
|
|
||||||
TAOS_FIELD* pField = &pFieldList->p[i];
|
|
||||||
if (pField->type < TSDB_DATA_TYPE_BOOL || pField->type > TSDB_DATA_TYPE_NCHAR) {
|
if (pField->type < TSDB_DATA_TYPE_BOOL || pField->type > TSDB_DATA_TYPE_NCHAR) {
|
||||||
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
||||||
return false;
|
return false;
|
||||||
|
@ -909,10 +900,19 @@ static bool validateTableColumnInfo(tFieldList* pFieldList, SSqlCmd* pCmd) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// field name must be unique
|
||||||
if (has(pFieldList, i + 1, pFieldList->p[i].name) == true) {
|
if (has(pFieldList, i + 1, pFieldList->p[i].name) == true) {
|
||||||
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nLen += pField->bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// max row length must be less than TSDB_MAX_BYTES_PER_ROW
|
||||||
|
if (nLen > TSDB_MAX_BYTES_PER_ROW) {
|
||||||
|
invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue