diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 658fdf06bb..ade2b846e2 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3341,6 +3341,7 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) { pRight->value.i64 = convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision); + pRight->flags &= ~(1 << EXPR_FLAG_NS_TIMESTAMP); } } @@ -4905,6 +4906,7 @@ int32_t getTimeRange(STimeWindow* win, tSqlExpr* pRight, int32_t optr, int16_t t */ if (pRight->flags & (1 << EXPR_FLAG_NS_TIMESTAMP)) { pRight->value.i64 = convertTimePrecision(pRight->value.i64, TSDB_TIME_PRECISION_NANO, timePrecision); + pRight->flags &= ~(1 << EXPR_FLAG_NS_TIMESTAMP); } tVariantDump(&pRight->value, (char*)&val, TSDB_DATA_TYPE_BIGINT, true); diff --git a/tests/script/general/parser/where.sim b/tests/script/general/parser/where.sim index d20f013a8e..781b2725b5 100644 --- a/tests/script/general/parser/where.sim +++ b/tests/script/general/parser/where.sim @@ -352,18 +352,24 @@ if $rows != 0 then return -1 endi -print ==========================> td-4783 +print ==========================> td-4783,td-4792 sql create table where_ts(ts timestamp, f int) sql insert into where_ts values('2021-06-19 16:22:00', 1); sql insert into where_ts values('2021-06-19 16:23:00', 2); sql insert into where_ts values('2021-06-19 16:24:00', 3); sql insert into where_ts values('2021-06-19 16:25:00', 1); sql select * from (select * from where_ts) where ts<'2021-06-19 16:25:00' and ts>'2021-06-19 16:22:00' -if $row != 2 then +if $rows != 2 then return -1 endi print $data00, $data01 if $data01 != 2 then return -1 endi +sql insert into where_ts values(now, 5); +sleep 10 +sql select * from (select * from where_ts) where ts