Expand description
The PRIMARY KEY and UNIQUE constraints of a new table. transformIndexConstraints validates the declared keys before the relation exists, and DefineIndex checks and names each key’s index after DefineRelation has cloned the keys of a partition’s parent.
Structs§
- Inherited
Definitions - What a new table takes from its parents before its own definitions: the columns whose expressions the parents give, and the keys and foreign keys a partition clones from its parent.
Functions§
- clone_
parent_ keys - The keys a partition clones from its parent, which
DefineRelationcreates before the table’s CHECK constraints: each unique index cloned from the parent is checked against the table’s own partition key, and each cloned key’s index is named, a name the CHECKs the table inherits hold being taken, and takes its OIDs; thenCloneForeignKeyConstraintscreates the partition’s copies of the parent’s foreign keys. The namer goes on to name the declared keys. - declare_
primary_ key_ not_ null - A declared primary key makes each of its columns NOT NULL through a constraint of the new table: an inherited NOT NULL becomes local and takes the name generated for the new table, as
AddRelationNotNullConstraintsmerges the declaration with the inherited constraint. - define_
declared_ keys - Define the keys the table declares as
DefineIndexdoes once the table’s CHECK and NOT NULL constraints exist: each key, primary key first, against an inherited primary key, the partition key and its index attributes. Each key’s index is named after its checks, so a later key’s errors follow an earlier key’s name conflict, and no index takes a name a constraint of the table holds; the index then takes its OID and the constraint its own. - transform_
declared_ keys - Validate the keys a CREATE TABLE declares, in declaration order, then order them as
transformIndexConstraintsdoes: the primary key first, and a key whose index would repeat an earlier key’s index dropped, giving its name to that key when the earlier key has none.