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.

Naming an EXISTS columndoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT EXISTS (SELECT 1)')->field(0)->name->value // => 'exists'

Properties§

public Query $query

Methods§

public function __construct(public Query $query)

Parameters

$queryQueryThe query inside the parentheses
public function outputName(): Name

Names an unaliased result column exists.

Returns

Test cases 1
Calls 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the query; the test is a boolean that is never NULL.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes EXISTS and the query in parentheses.

Parameters

$outOutput
Test cases 1
Calls 1

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