final class Between
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A range test: a [NOT] BETWEEN [SYMMETRIC] low AND high.

Mirrors PostgreSQL's A_Expr node of kind AEXPR_BETWEEN, AEXPR_NOT_BETWEEN, AEXPR_BETWEEN_SYM or AEXPR_NOT_BETWEEN_SYM. The optional ASYMMETRIC is the default and requests nothing (see the noise table). SYMMETRIC accepts the bounds in either order.

Rule: PG-BETWEEN-001. Facts: a >= low AND a <= high: the conjunction of the two comparisons (PG-OPERATOR-TYPING-001), NULL when an operand can be. The value must keep its place before BETWEEN, the low bound is a b_expr, and the high bound must keep its place (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-comparison.html#FUNCTIONS-COMPARISON-PRED-TABLE. Status: Implemented.

Reading a symmetric range testdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 2 NOT BETWEEN SYMMETRIC 3 AND 1');
    [$query->field(0)->expression->negated, $query->field(0)->expression->symmetric, $query->toString()] // => [true, true, 'SELECT 2 NOT BETWEEN SYMMETRIC 3 AND 1']

Properties§

public Scalar $operand
public bool $negated
public bool $symmetric
public Scalar $low
public Scalar $high

Methods§

public function __construct(
    public Scalar $operand,
    public bool $negated,
    public bool $symmetric,
    public Scalar $low,
    public Scalar $high,
)

Parameters

$operandScalarThe tested value
$negatedboolWhether NOT is written
$symmetricboolWhether SYMMETRIC is written
$lowScalarThe first bound, a `b_expr`
$highScalarThe second bound
Calls 6
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the bounds, and the comparisons of the value with them.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 7
public function render(Output $out): void

Writes the value, [NOT] BETWEEN [SYMMETRIC] and the bounds.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 4

Relations§

Instantiated in 1
Type checks 1
Type declarations 1