classExists
final class Exists
implements Scalar, OutputNaming
uses Snapshot
Public API: explicitly declared with
@visibility public.A test of whether a query returns a row: EXISTS (SELECT …).
Mirrors PostgreSQL's SubLink node of kind EXISTS_SUBLINK.
Rule: PG-EXISTS-001. The query is derived in the environment of the expression. Facts: boolean, never NULL; an unaliased result column is named exists. Source: https://www.postgresql.org/docs/17/functions-subquery.html#FUNCTIONS-SUBQUERY-EXISTS. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT EXISTS (SELECT 1)')->field(0)->name->value // => 'exists'Properties§
public Query $queryMethods§
public function __construct(public Query $query)Parameters
$query | Query | The query inside the parentheses |
public function outputName(): NameNames an unaliased result column exists.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the query; the test is a boolean that is never NULL.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call Derivation::query() line 58
- new ScalarFact line 60
- new Known line 60
- class-const Builtin::Bool() line 60
- class-const Nullability::NotNull() line 60
public function render(Output $out): voidWrites EXISTS and the query in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 68
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.