classDistinctTest
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.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 IS DISTINCT FROM NULL')->field(0)->nullability // => \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::NotNullProperties§
public Scalar $leftpublic Scalar $rightpublic bool $negatedMethods§
public function __construct(public Scalar $left, public Scalar $right, public bool $negated)Parameters
$left | Scalar | The left operand |
$right | Scalar | The right operand |
$negated | bool | Whether NOT is written, so that the test is for equality |
Calls 5
- new Precedence line 45
- static-call Check::input() line 46
- method-call Precedence::before() line 46
- class-const Precedence::IS() line 46
- method-call Precedence::after() line 47
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operands and the type of their equality.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call Derivation::scalar() line 55
- new ScalarFact line 58
- method-call OperatorTyping::named() line 58
- new OperatorTyping line 58
- class-const Nullability::NotNull() line 58
public function render(Output $out): voidWrites the operands around IS [NOT] DISTINCT FROM.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 66
- method-call Output::keyword() line 68
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
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\OperatorRule::postfix() packages/sql-semantics-postgres/src/Lowering/Expression/OperatorRule.php:113
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\OperatorRule::postfix() packages/sql-semantics-postgres/src/Lowering/Expression/OperatorRule.php:118
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Precedence::operators() packages/sql-semantics-postgres/src/Rules/Expression/Precedence.php:228
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Precedence::restricted() packages/sql-semantics-postgres/src/Rules/Expression/Precedence.php:285