From 5fd697bfe9a650c0939c9398eb448b23a76721cd Mon Sep 17 00:00:00 2001 From: lihui Date: Fri, 14 Feb 2020 10:52:57 +0800 Subject: [PATCH] [#1197] --- src/client/src/tscSQLParser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 5652dbf58a..c6bc3c2288 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1655,7 +1655,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta); // functions can not be applied to tags - if (index.columnIndex >= pMeterMetaInfo->pMeterMeta->numOfColumns) { + if ((index.columnIndex >= pMeterMetaInfo->pMeterMeta->numOfColumns) || (index.columnIndex < 0)) { return invalidSqlErrMsg(pQueryInfo->msg, msg6); } @@ -5663,4 +5663,4 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { bool hasDefaultQueryTimeRange(SQueryInfo *pQueryInfo) { return (pQueryInfo->stime == 0 && pQueryInfo->etime == INT64_MAX) || (pQueryInfo->stime == INT64_MAX && pQueryInfo->etime == 0); -} \ No newline at end of file +} -- GitLab