Skip to content

Potential bug in BETWEEN operator #7839

@mrigger

Description

@mrigger

Consider the following two statements:

SELECT (-1 BETWEEN 0 AND NULL) IS NULL FROM RDB$DATABASE; -- <true>
SELECT NOT (-1 BETWEEN 0 AND NULL) FROM RDB$DATABASE; -- <true>

It is unexpected that both of them evaluate to true, since the expression -1 BETWEEN 0 AND NULL cannot evaluate to null and false at the same time. Based on this, I believe that the BETWEEN operator implementation is affected by a bug.

I checked that this reproduces in the latest release version (4.0.4): The version string is (WI-V4.0.4.3010 Firebird 4.0).

I originally found this in version 4.0.2 using the latest Dockerfile available at https://hub.docker.com/r/jacobalberty/firebird.

Metadata

Metadata