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

An array built from values: ARRAY[a, b], ARRAY[[a, b], [c, d]].

Mirrors PostgreSQL's A_ArrayExpr node.

Rule: PG-ARRAY-CONSTRUCTOR-001. Facts: an array of the common type of the values (PG-UNIFICATION-001; unknown-typed values give text); values that are arrays, and sub-arrays, make a multidimensional array of the same type; an empty array has no element type of its own, which a cast supplies; the array is never NULL. An unaliased result column is named array. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS. Status: Implemented.

Typing an array of mixed numbersdoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT ARRAY[1, 2.5]')->field(0)->type->descriptor->name() // => 'numeric[]'

Properties§

public ArrayItems $items

Methods§

public function __construct(public ArrayItems $items)

Parameters

$itemsArrayItemsThe bracketed items
public function outputName(): Name

Names an unaliased result column array.

Returns

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

Derives every value and the array type.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes ARRAY and the items.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 5§

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

Dedicated tests 4
Other tests reaching this symbol 1

Relations§

Instantiated in 1