record Data Type
New in v0.4.0.
record is a tuple that can contain an arbitrary number of elements of any
Record types can be used to represent nested data.
The fields of a record are named
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.
record is a named type in PostgreSQL (
pg_catalog.record), but is
currently an unnameable type in Materalize.
You cannot cast from any other types to
SELECT ROW(1, 2) AS record;
record -------- (1,2)
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