Skip to content

BETWEEN Expression Evaluates Left Side Twice #5152

@LeMikaelF

Description

@LeMikaelF

Description

BETWEEN expressions evaluate the left side twice per row.

Reproducer

CREATE TABLE t(id INTEGER PRIMARY KEY);
INSERT INTO t VALUES(1), (2), (3);

SELECT id FROM t WHERE (SELECT max(id) FROM t) BETWEEN 1 AND 3;
-- Subquery executed twice per row

core/translate/expr.rs:4025-4048 - BETWEEN expands to two comparisons, each calling translate_expr(left).


This issue brought to you by Mikaël and Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions