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

A comparison that treats NULL as a comparable value: a IS [NOT] DISTINCT FROM b.

Mirrors PostgreSQL's A_Expr node of kind AEXPR_DISTINCT or AEXPR_NOT_DISTINCT; the server evaluates it with the = operator of the operand types.

Rule: PG-DISTINCT-001. Facts: the type of = over the operands (PG-OPERATOR-TYPING-001), never NULL. Both operands must keep their place without parentheses (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-comparison.html. Status: Implemented.

A distinctness test is never NULLdoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 IS DISTINCT FROM NULL')->field(0)->nullability // => \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::NotNull

Properties§

public Scalar $left
public Scalar $right
public bool $negated

Methods§

public function __construct(public Scalar $left, public Scalar $right, public bool $negated)

Parameters

$leftScalarThe left operand
$rightScalarThe right operand
$negatedboolWhether NOT is written, so that the test is for equality
Calls 5
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operands and the type of their equality.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operands around IS [NOT] DISTINCT FROM.

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 3
Other tests reaching this symbol 1

Relations§

Instantiated in 2
Type checks 2