classCoalesce
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.
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Conditional\Coalesce([new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()]))->outputName()->value // => 'coalesce'Properties§
public non-empty-list<Scalar> $valuesMethods§
public function __construct(list<Scalar> $values)Parameters
$values | list<Scalar> | The values in order; at least one |
Calls 2
- static-call Check::listOf() line 47
- class-const Scalar::class() line 47
public function outputName(): NameNames an unaliased result column.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the values, their common type and the NULL fact.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Derivation::scalar() line 66
- new ScalarFact line 71
- method-call Unification::resolve() line 71
- new Unification line 71
- method-call Coalescing::nullability() line 71
- new Coalescing line 71
public function render(Output $out): voidWrites COALESCE with the values.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 79
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.