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

COALESCE (values): the first value that is not NULL.

Mirrors PostgreSQL's CoalesceExpr. Rule: PG-COALESCE-001. Facts: the common type of the values as UNION and CASE resolve it (Rules\Expression\Unification); the NULL rule PG-COALESCING-NULL-001. The result column is named coalesce. Source: https://www.postgresql.org/docs/17/functions-conditional.html#FUNCTIONS-COALESCE-NVL-IFNULL, https://www.postgresql.org/docs/17/typeconv-union-case.html. Status: Implemented.

Naming the result columndoctest
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Conditional\Coalesce([new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()]))->outputName()->value // => 'coalesce'

Properties§

public non-empty-list<Scalar> $values

Methods§

public function __construct(list<Scalar> $values)

Parameters

$valueslist<Scalar>The values in order; at least one
Calls 2
public function outputName(): Name

Names an unaliased result column.

Returns

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

Derives the values, their common type and the NULL fact.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes COALESCE with the values.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 4§

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

Dedicated tests 4

Relations§

Instantiated in 1