Skip to content

(time=time) trigger Error #567

@timbytimmy

Description

@timbytimmy

Step to Reproduce

--create bucket
CREATE DATABASE hintdb0;
USE hintdb0;
CREATE RETENTION POLICY "autogen" ON "hintdb0" DURATION INF REPLICATION 1 DEFAULT;

--insert data
INSERT t1,t1_f0=1 value=10 1641024028331837795
INSERT t1,t1_f0=1 value=11 1641024040091924467
INSERT t1,t1_f0=2 value=12 1730160367375000000
INSERT t1,t1_f0=3 value=13 1673100999751000000
INSERT t2,t2_f0=-146 value=22 1641024141329705070
INSERT t2,t2_f0=-146 value=23 1641024187641544505
INSERT t4,t4_f0=0.17 value=33 1641024266393313153
INSERT t4,t4_f0=0.17 value=34 1641024295432559539

Now query query 1 and then add (time = time) in query 2

--query 1
SELECT t1_f0 AS ref0 FROM hintdb0.autogen.t1
WHERE(((0.169971904196 <= 0.169971904197) AND (0.169971904197 <= 0.169971904198))) AND (time >= 1641024028331837795) AND (time <= 1641024040091924467);

--query 2
SELECT t1_f0 AS ref0 FROM hintdb0.autogen.t1
WHERE(((0.169971904196 <= 0.169971904197) AND (0.169971904197 <= 0.169971904198))) AND (time >= 1641024028331837795) AND (time <= 1641024040091924467) AND (time = time);

Expected behaviour
Both queries should execute successfully and return the corresponding results.

Actual behaviour
query 1 : return correctly
query 2 : error: invalid operation: time and *influxql.VarRef are not compatible


-The predicate time = time is logically equivalent to TRUE and is commonly used in testing/fuzzing as a semantics-preserving hint.

-The error only appears when the query already contains multiple concrete time predicates (including expressions like time >= (const + const) or time >= (const - const)) and we then add AND (time = time).

-Queries that add other tautologies such as AND TRUE or AND (1=1) do not trigger the error

Environment
InfluxDB: 1.8.10-1 (tested via influx v1 shell)
Windows 11 version (10.0.26100 build 26100)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions