When there are multiple records (more than one) in the table, there is a logical error in the SELECT statement when the time field is used as the subtrahend. The abstract expression sequence is: (CONSTANT - time) > CONSTANT
To Reproduce
Assume that we execute the following statement under a database named testdb.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1( time TIMESTAMP, c1 BIGINT);
INSERT INTO t1(time, c1) VALUES (1641024000000, 0);
INSERT INTO t1(time, c1) VALUES (1641024000001, 1);
# query 1
SELECT CAST(time AS BIGINT) FROM t1 WHERE (1 - time) > 0;
Expected Behavior
Query 1 returned result set: empty set
Actual behaviour
Query 1 returned result set: 1 and 0
Environment
OS:Ubuntu Server 22.04 LTS 64bit
TDengine Version:3.3.4.3
Additional Context
Hello, TDengine team. When there is more than one record in the table, and the time field is used as the subtrahend in a predicate expression, the expression logic evaluates to FALSE, but all data can still be retrieved.
Bug Description
When there are multiple records (more than one) in the table, there is a logical error in the
SELECT
statement when thetime
field is used as the subtrahend. The abstract expression sequence is:(CONSTANT - time) > CONSTANT
To Reproduce
Assume that we execute the following statement under a database named testdb.
Expected Behavior
Query 1 returned result set: empty set
Actual behaviour
Query 1 returned result set: 1 and 0
Environment
Additional Context
Hello, TDengine team. When there is more than one record in the table, and the
time
field is used as the subtrahend in a predicate expression, the expression logic evaluates toFALSE
, but all data can still be retrieved.