classQuantifiedArray
final class QuantifiedArray
implements Scalar
uses Snapshot
@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.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 = ANY (ARRAY[1, 2])')->field(0)->type->descriptor->name() // => 'boolean'Properties§
public Scalar $operandpublic OperatorName|MatchKeyword $comparatorpublic Quantifier $quantifierpublic Scalar $arrayMethods§
public function __construct(
public Scalar $operand,
public OperatorName|MatchKeyword $comparator,
public Quantifier $quantifier,
public Scalar $array,
)Parameters
$operand | Scalar | The compared value |
$comparator | OperatorName|MatchKeyword | The operator |
$quantifier | Quantifier | The quantifier |
$array | Scalar | The array; not a scalar subquery |
Calls 5
- static-call Check::input() line 49
- new Precedence line 51
- method-call Precedence::before() line 52
- method-call Precedence::operator() line 52
- class-const Precedence::PATTERN() line 52
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the value and the array, and the comparison of the value with its elements.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- method-call Derivation::scalar() line 60
- new OperatorName line 62
- new Name line 62
- new ScalarFact line 64
- method-call Sublinks::elements() line 64
- new Sublinks line 64
- class-const Nullability::Nullable() line 64
public function render(Output $out): voidWrites the value, the operator, the quantifier and the array in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 3
- method-call Output::node() line 72
- method-call Output::keyword() line 76
- function-call
explodeline 76
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.