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

JSON_ARRAYAGG (value [ORDER BY ...] [NULL | ABSENT ON NULL] [RETURNING type]) with FILTER and OVER.

Mirrors PostgreSQL's JsonArrayAgg with its JsonAggConstructor. Rule: PG-JSON-ARRAYAGG-001. Facts: the value, the ordering, the filter and the window are derived at the position; the RETURNING type, otherwise json; NULL over no row. The result column is named json_arrayagg. Source: https://www.postgresql.org/docs/17/functions-aggregate.html. Status: Implemented.

Naming the result columndoctest
(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonArrayAggregate(new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\JsonValueExpression(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral())))->outputName()->value // => 'json_arrayagg'

Properties§

public list<SortItem> $order
public JsonNullHandling|null $nulls = null
public JsonReturning|null $returning = null
public Scalar|null $filter = null
public WindowSpecification|Name|null $over = null

Methods§

public function __construct(
    public JsonValueExpression $value,
    list<SortItem> $order = [],
    public JsonNullHandling|null $nulls = null,
    public JsonReturning|null $returning = null,
    public Scalar|null $filter = null,
    public WindowSpecification|Name|null $over = null,
)

Parameters

$valueJsonValueExpressionThe value aggregated
$orderlist<SortItem>The ordering of the elements
$nullsJsonNullHandling|nullThe NULL clause written
$returningJsonReturning|nullThe RETURNING clause
$filterScalar|nullThe FILTER predicate
$overWindowSpecification|Name|nullThe window after OVER
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 value, the ordering, the clauses, the filter and the window.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes JSON_ARRAYAGG with its clauses, the filter and the window.

Parameters

$outOutput
Test cases 1
Calls 3

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