classComposite
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.
$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> $fieldspublic Name|null $relation = nullMethods§
public function __construct(list<OutputSlot> $fields, public Name|null $relation = null)Parameters
$fields | list<OutputSlot> | The fields in order |
$relation | Name|null | The relation whose row type this is, or null for an anonymous record |
Calls 2
- static-call Check::listOf() line 41
- class-const OutputSlot::class() line 41
public function name(): stringAnswers the type name: the relation's name, or record.
Returns
stringTest 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
OperandChecksTest::testFieldsReadsTheFieldsOfRowscallsSublinksTest::testValueIsARowForSeveralColumnscallsSubscriptingTest::testFieldReadsTheSlotOfACompositecallsWholeRowsTest::testFindSearchesTheEnclosingLevelscallsColumnReferenceTest::testDeriveScalarReadsAOneWordNameAsTheWholeRowOfARelationcallsColumnStarTest::testDeriveScalarIsTheWholeRowOfTheRelationcallsRowConstructorTest::testDeriveScalarIsARecordOfTheFieldscalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks::value() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:58
- new SqlSemantics\Platform\PostgreSql\Rules\Expression\WholeRows::row() packages/sql-semantics-postgres/src/Rules/Expression/WholeRows.php:91
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Constructor\RowConstructor::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Constructor/RowConstructor.php:79
Type checks 6
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\OperandChecks::fields() packages/sql-semantics-postgres/src/Rules/Expression/OperandChecks.php:116
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::structured() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:131
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::structured() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:132
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks::compared() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:91
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Subscripting::field() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Subscripting.php:122
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Assignments::types() packages/sql-semantics-postgres/src/Rules/Manipulation/Assignments.php:224