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

A conjunction or disjunction of two conditions: a AND b, a OR b.

Mirrors PostgreSQL's BoolExpr node of kind AND_EXPR or OR_EXPR. The parser flattens a chain into one node; the model keeps the binary structure and the groupings as written, which evaluate the same.

Rule: PG-BOOLEAN-OPERATION-001. Facts: boolean; an operand whose type is not boolean (after an unknown-typed constant takes boolean) is reported; the result can be NULL when an operand can. Both operands must keep their place without parentheses (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-logical.html. Status: Implemented.

Reading a disjunctiondoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT true OR false AND false');
    $query->field(0)->expression->right->operator // => \SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\BooleanOperator::And

Properties§

public BooleanOperator $operator
public Scalar $left
public Scalar $right

Methods§

public function __construct(
    public BooleanOperator $operator,
    public Scalar $left,
    public Scalar $right,
)

Parameters

$operatorBooleanOperatorThe operator
$leftScalarThe left condition
$rightScalarThe right condition
Calls 7
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives both conditions and checks that they are boolean.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the conditions around the operator.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 7§

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

Dedicated tests 4
Other tests reaching this symbol 3

Relations§

Instantiated in 2
Type checks 1