提交 26acb61e 编写于 作者: G Ganlin Zhao

[TD-10797]<fix>: when column length is long, report 'invalid column name' error

上级 b271a14d
......@@ -436,7 +436,7 @@ int32_t readFromFile(char *name, uint32_t *len, void **buf) {
int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char *msg1 = "invalidate function name";
const char *msg1 = "invalid function name or length";
const char *msg2 = "path is too long";
const char *msg3 = "invalid outputtype";
const char *msg4 = "invalid script";
......@@ -1483,9 +1483,8 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
const char* msg3 = "duplicated column names";
const char* msg4 = "invalid data type";
const char* msg5 = "invalid binary/nchar column length";
const char* msg6 = "invalid column name";
const char* msg6 = "invalid column name or length";
const char* msg7 = "too many columns";
const char* msg8 = "invalid column name length";
// number of fields no less than 2
size_t numOfCols = taosArrayGetSize(pFieldList);
......@@ -1523,13 +1522,8 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
return false;
}
int32_t code = validateColumnName(pField->name);
if (code != TSDB_CODE_SUCCESS) {
if (code == TSDB_CODE_TSC_INVALID_COLUMN_LENGTH) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8);
} else {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
}
if (validateColumnName(pField->name) != TSDB_CODE_SUCCESS) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6);
return false;
}
......@@ -1560,7 +1554,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
const char* msg3 = "duplicated column names";
//const char* msg4 = "timestamp not allowed in tags";
const char* msg5 = "invalid data type in tags";
const char* msg6 = "invalid tag name";
const char* msg6 = "invalid tag name or length";
const char* msg7 = "invalid binary/nchar tag length";
// number of fields at least 1
......@@ -1629,7 +1623,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
*/
int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
const char* msg3 = "tag length too long";
const char* msg4 = "invalid tag name";
const char* msg4 = "invalid tag name or length";
const char* msg5 = "invalid binary/nchar tag length";
const char* msg6 = "invalid data type in tags";
const char* msg7 = "too many columns";
......@@ -1702,7 +1696,7 @@ 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";
const char* msg5 = "invalid column name or length";
const char* msg6 = "invalid column length";
// assert(pCmd->numOfClause == 1);
......@@ -2060,7 +2054,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
const char* msg8 = "not support distinct in nest query";
const char* msg9 = "_block_dist not support subquery, only support stable/table";
const char* msg10 = "not support group by in block func";
const char* msg11 = "invalid alias name";
const char* msg11 = "invalid alias name or length";
// too many result columns not support order by in query
if (taosArrayGetSize(pSelNodeList) > TSDB_MAX_COLUMNS) {
......@@ -6770,8 +6764,9 @@ int32_t validateLocalConfig(SMiscInfo* pOptions) {
int32_t validateColumnName(char* name) {
if (strlen(name) == 0) {
return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH;
return TSDB_CODE_TSC_INVALID_OPERATION;
}
bool ret = taosIsKeyWordToken(name, (int32_t)strlen(name));
if (ret) {
return TSDB_CODE_TSC_INVALID_OPERATION;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册