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

A comparison with every row of a query: a op ANY (SELECT …), SOME, ALL.

Mirrors PostgreSQL's SubLink node of kind ANY_SUBLINK or ALL_SUBLINK with its operator name.

Rule: PG-QUANTIFIED-SUBQUERY-001. The query is derived in the environment of the expression and returns one column, or as many as the fields of a row constructor on the left. Facts: the type of the operator over the value and the column (PG-OPERATOR-TYPING-001); the result can be NULL. The value must keep its place before the operator (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-subquery.html#FUNCTIONS-SUBQUERY-ANY-SOME. Status: Implemented.

Comparing with every rowdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 < ALL (SELECT 2)');
    [$query->field(0)->expression->comparator->name->value, $query->field(0)->type->descriptor->name()] // => ['<', 'boolean']

Properties§

public Scalar $operand
public Quantifier $quantifier
public Query $query

Methods§

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

Parameters

$operandScalarThe compared value
$comparatorOperatorName|MatchKeywordThe operator
$quantifierQuantifierThe quantifier
$queryQueryThe query inside the parentheses
Calls 5
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the query, and the comparison of the value with its rows.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

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

Parameters

$outOutput
Test cases 1
Calls 3

Test cases 3§

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

Dedicated tests 3

Relations§

Instantiated in 1
Type checks 1