final class Composite
    implements TypeDescriptor
    uses Snapshot
Public API: explicitly declared with @visibility public.

A composite value whose fields are known: a row constructor or the whole row of a relation.

A row constructor yields an anonymous record with fields f1, f2, …; the whole row of a relation has the relation's row type, whose fields are its columns. Selecting a field reads its slot. Source: https://www.postgresql.org/docs/17/rowtypes.html, https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS.

Reading the fields of a row constructordoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT ROW(1, 2)');
    [$query->field(0)->type->descriptor->name(), $query->field(0)->type->descriptor->fields[1]->name->value] // => ['record', 'f2']

Properties§

public list<OutputSlot> $fields
public Name|null $relation = null

Methods§

public function __construct(list<OutputSlot> $fields, public Name|null $relation = null)

Parameters

$fieldslist<OutputSlot>The fields in order
$relationName|nullThe relation whose row type this is, or null for an anonymous record
Calls 2
public function name(): string

Answers the type name: the relation's name, or record.

Returns

string
Test cases 1

Test cases 8§

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

Dedicated tests 1
Other tests reaching this symbol 7

Relations§

Instantiated in 3
Type checks 6