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

A comparison with every element of an array: a op ANY (array), SOME, ALL.

Mirrors PostgreSQL's A_Expr node of kind AEXPR_OP_ANY or AEXPR_OP_ALL.

Rule: PG-QUANTIFIED-ARRAY-001. Facts: the type of the operator over the value and the array's element type (PG-OPERATOR-TYPING-001); a right operand that is not an array is reported; the result can be NULL. A scalar subquery in the parentheses is read as op ANY (SELECT …) instead, so it cannot be the array here. The value must keep its place before the operator (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-comparisons.html#FUNCTIONS-COMPARISONS-ANY-SOME. Status: Implemented.

Comparing with the elements of an arraydoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 = ANY (ARRAY[1, 2])')->field(0)->type->descriptor->name() // => 'boolean'

Properties§

public Scalar $operand
public Quantifier $quantifier
public Scalar $array

Methods§

public function __construct(
    public Scalar $operand,
    public OperatorName|MatchKeyword $comparator,
    public Quantifier $quantifier,
    public Scalar $array,
)

Parameters

$operandScalarThe compared value
$comparatorOperatorName|MatchKeywordThe operator
$quantifierQuantifierThe quantifier
$arrayScalarThe array; not a scalar subquery
Calls 5
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the array, and the comparison of the value with its elements.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the value, the operator, the quantifier and the array in parentheses.

Parameters

$outOutput
Test cases 1
Calls 3

Test cases 5§

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 1

Relations§

Instantiated in 1
Type checks 1