Composite

data class Composite(val oid: Int, val name: String, val schema: String, val attributes: LinkedHashMap<String, Int>, val relationOid: Int = 0, val attributeNumbers: List<Int> = emptyList()) : PgType

Represents a PostgreSQL composite type (row type).

Every relation has one of these - a table, a view, a materialized view - carrying that relation's columns under the relation's own name, and relationOid is what ties the two together.

Constructors

Link copied to clipboard
constructor(oid: Int, name: String, schema: String, attributes: LinkedHashMap<String, Int>, relationOid: Int = 0, attributeNumbers: List<Int> = emptyList())

Properties

Link copied to clipboard

A list of the names of the attributes in the composite type, in declaration order.

Link copied to clipboard

The attribute number of each attribute, in the same order as attributes. Not the index plus one: a dropped column keeps its number for good, leaving a hole that everything declared after it sits behind.

Link copied to clipboard

A list of the OIDs of the attributes in the composite type, in declaration order.

Link copied to clipboard

A map of attribute names to their respective OIDs, preserving declaration order.

Link copied to clipboard
open override val name: String

The name of the type.

Link copied to clipboard

A mapping from attribute name to its zero-based index in the composite type.

Link copied to clipboard
open override val oid: Int

The Object Identifier (OID) of the type.

Link copied to clipboard

The OID of the relation this type describes (pg_class.oid), which for a type declared with CREATE TYPE ... AS (...) is the entry PostgreSQL creates to hold its attributes.

Link copied to clipboard
open override val schema: String

The schema in which the type is defined.

Functions

Link copied to clipboard
fun attributeNameByNumber(attributeNumber: Int): String?

Returns the name of the attribute carrying attributeNumber, or null when this type has no attribute under that number - a dropped column's, a system column's, or any number at all for a type loaded without them.