classMinMax
final class MinMax
implements Scalar, OutputNaming
uses Snapshot
Public API: explicitly declared with
@visibility public.GREATEST (values) or LEAST (values).
Mirrors PostgreSQL's MinMaxExpr. Rule: PG-MINMAX-001. Facts: the common type of the values (Rules\Expression\Unification); NULL values are ignored, so the NULL rule is PG-COALESCING-NULL-001. The result column is named greatest or least. Source: https://www.postgresql.org/docs/17/functions-conditional.html#FUNCTIONS-GREATEST-LEAST. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Conditional\MinMax(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Conditional\MinMaxKind::Greatest, [new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()]))->outputName()->value // => 'greatest'Properties§
public non-empty-list<Scalar> $valuespublic MinMaxKind $kindMethods§
public function __construct(public MinMaxKind $kind, list<Scalar> $values)Parameters
$kind | MinMaxKind | Which extreme is selected |
$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 after the function.
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 the function keyword 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.
Dedicated tests 4
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\SyntaxRule::special() packages/sql-semantics-postgres/src/Lowering/Invocation/SyntaxRule.php:118
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\SyntaxRule::special() packages/sql-semantics-postgres/src/Lowering/Invocation/SyntaxRule.php:119