Materialize Logo

record Data Type

New in v0.4.0.

A record is a tuple that can contain an arbitrary number of elements of any type.

Detail Info
Quick Syntax ROW($expr, ...)
Size Variable


ROW ( expr , expr )


Record types can be used to represent nested data.

The fields of a record are named field1, field2, and so on. To access a field of a record, use the . operator. Note that you need to parenthesize the record expression to ensure that the . is interpreted as the field selection operator, rather than part of a database- or schema-qualified table name.


SELECT ROW(1, 2) AS record;

SELECT record, (record).f2 FROM (SELECT ROW(1, 2) AS record);
record | f2
 (1,2)  |  2

Forgetting to parenthesize the record expression in a field selection operation will result in errors like the following

SELECT record.f2 FROM (SELECT ROW(1, 2) AS record);
ERROR:  column "record.f2" does not exist

as the expression record.f2 specifies a column named f2 from a table named record, rather than the field f2 from the record-typed column named record.