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

A row value built from fields: ROW(a, b) or (a, b).

Mirrors PostgreSQL's RowExpr node. A field written t.* expands to the columns of the relation.

Rule: PG-ROW-001. Facts: an anonymous record whose fields f1, f2, … have the types and NULL facts of the written fields, the row itself never NULL; an unaliased result column is named row. The implicit spelling needs at least two fields: one field in parentheses is a grouping. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS. Status: Implemented.

Reading the fields of a rowdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT ROW(1, 'a')");
    [count($query->field(0)->expression->fields), $query->field(0)->name->value] // => [2, 'row']
Rejecting an implicit row of one fielddoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\RowConstructor([new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()], \SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\RowSpelling::Implicit) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Scalar> $fields
public RowSpelling $spelling = RowSpelling::Explicit

Methods§

public function __construct(
    list<Scalar> $fields,
    public RowSpelling $spelling = RowSpelling::Explicit,
)

Parameters

$fieldslist<Scalar>The fields in order
$spellingRowSpellingHow the row is written
Calls 5
public function outputName(): Name

Names an unaliased result column row.

Returns

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

Derives the fields and the record they make.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the fields in parentheses, after ROW when written so.

Parameters

$outOutput
Test cases 1
Calls 3

Test cases 10§

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 6

Relations§

Instantiated in 3
Type checks 5
Type declarations 4