Expand description
The rupg catalog of user objects: schemas, tables, columns, constraints, indexes, roles, privileges.
At M2 the catalog holds the schemas, tables, sequences, indexes, views, column defaults, constraints and text search objects that DDL makes. Each object gets its OID in the order that PostgreSQL 19 gives OIDs, and each object without a name in the statement gets the name that PostgreSQL gives it. Thus after the same statements on a new cluster, the OIDs and the names are the same as in PostgreSQL.
The catalog does not read SQL. The analyzer turns a statement into calls of this crate in the order of DefineRelation, DefineIndex and ATAddForeignKeyConstraint, and it gives each expression as text that only the analyzer reads back. The catalog makes the TOAST tables that PostgreSQL makes, with their indexes, but they hold no data. It also makes the four internal triggers of each foreign key, which have no work to do because the tables have no rows. The catalog also records the rows of pg_depend in the order that PostgreSQL inserts them.
This crate first ships in milestone M2. See spec/22-crate-layout.md section 22.4 and spec/23-milestones.md.
Re-exports§
pub use database::Database;pub use tablespace::Tablespace;
Modules§
- database
- The rows of
pg_database. The catalog of a database holds the objects of that database, and the rows ofpg_databaseare the same for all databases of the cluster, so the store of the server keeps them. - flag
- The reasons that the walk reached an object, the bits
DEPFLAG_*ofdependency.c. - names
- The names that PostgreSQL makes for objects that a statement does not name, as
makeObjectName,ChooseIndexNameAdditionandChooseIndexColumnNamesofindexcmds.cmake them. - size
- The pages of a new relation in PostgreSQL. rupg keeps no files, so the catalog gives the pages that the files of PostgreSQL have when the relation is new.
- tablespace
- The rows of
pg_tablespacethatCREATE TABLESPACEmakes. A tablespace belongs to the cluster, so the store of the server keeps them, as it keeps the rows ofpg_database. The rows ofpg_defaultandpg_globalare static rows. - toast
- The TOAST decision of PostgreSQL. rupg has no TOAST tables, but a PostgreSQL table that has one uses two OIDs for it, so the catalog must know when PostgreSQL makes one.
Structs§
- Aggregate
- An aggregate function, one row of
pg_aggregate. - AmOp
- An operator of an operator family, one row of
pg_amop. - AmProc
- A support function of an operator family, one row of
pg_amproc. - Attr
Default - A column default, one row of
pg_attrdef. - Cast
- A cast, one row of
pg_cast. - Catalog
- The objects of one cluster, with the OID counter.
- Collation
- A collation, one row of
pg_collation. The catalog holds the collations thatpg_import_system_collationsmakes when the cluster starts. - Column
- A column of a relation, one row of
pg_attributewith a positiveattnum. - Constraint
- A constraint, one row of
pg_constraint. - Default
Acl - The default privileges of a role for the new objects of a kind, one row of
pg_default_acl. - Depend
- One row of
pg_depend. - Domain
- The facts of a domain that
pg_typeholds for a type of the kindd. - Enum
Label - A label of an enum type, one row of
pg_enum. - Extension
- An extension, one row of
pg_extension. - Foreign
Key - The facts of a foreign key.
- Function
- A function, one row of
pg_proc: a function of the setup of a new cluster, such as a function in SQL ofinformation_schema, or a function thatCREATE FUNCTIONmakes. - Function
Body - The body of a function in SQL, which the analyzer reads again each time a query calls the function, as it reads the query of a view.
- Index
Info - The facts of an index, one row of
pg_index. - Language
- A procedural language, one row of
pg_language. - Member
Link - The dependency facts of a member of a family, the fields
ref_is_hard,ref_is_familyandrefobjidofOpFamilyMember. - NewDomain
- A new domain for
Catalog::create_domain. - NewEnum
- A new enum type for
Catalog::create_enum. - NewForeign
Key - A new foreign key before it has an OID.
- NewIndex
- A new index before it has an OID.
- NewIndex
Column - A column of a new index.
- NewRange
- A new range type for
Catalog::create_range. - NewRelation
- A new table, a new index or a new sequence before it has an OID.
- NewRule
- The facts of a new rule for
Catalog::create_rule. - NewTrigger
- The facts of a new trigger for
Catalog::create_trigger. - ObjRef
- An object as
pg_dependnames it: the OID of its catalog, its OID and a column number or 0. - OpClass
- An operator class, one row of
pg_opclass. - OpFamily
- An operator family, one row of
pg_opfamily. - Operator
- An operator, one row of
pg_operator. - Partition
Key - The partition key of a partitioned table, one row of
pg_partitioned_table. - Partition
Of - The parent table and the bound of a partition.
- Range
Info - The facts of a range type, one row of
pg_range. - Relation
- A relation: a table, an index, a sequence or a TOAST table.
- Rule
- A rule of
CREATE RULE, one row ofpg_rewrite. The_RETURNrule of a view is part ofViewInfo, not aRule. - Schema
- A schema.
- Sequence
Data - The row of the file of a sequence,
FormData_pg_sequence_data. - Sequence
Info - The facts of a sequence, one row of
pg_sequence. - StatExt
- An extended statistics object, one row of
pg_statistic_ext. - Target
- An object that a removal takes away,
ObjectAddressExtrawith its address. - Trigger
- A trigger, one row of
pg_trigger: a trigger ofCREATE TRIGGER, or an internal trigger of a foreign key. - TsConfig
- A text search configuration, one row of
pg_ts_config. - TsDictionary
- A text search dictionary, one row of
pg_ts_dict. - TsMapping
- One row of
pg_ts_config_map: for a token type of a configuration, the dictionary with this place in the list. - TsParser
- A text search parser, one row of
pg_ts_parser. - TsTemplate
- A text search template, one row of
pg_ts_template. - Type
- A row type, a domain, or the array type of one of them.
- View
Info - The query of a view and its
_RETURNrule.
Enums§
- ConKind
- The kind of a constraint,
contype. - DepKind
- The kind of a dependency,
deptype. - FkSide
- The side of a foreign key that a row of
pg_constraintserves, asaddFkConstrainttakes it. - Part
Strategy - The strategy of a partition key,
partstrat. - Partition
Bound - The bound of a partition,
relpartbound. - Range
Datum - A datum of the bound of a range partition.
- Range
Part - The part of a type in a range type.
- Refusal
- The reason that a removal cannot start.
- RelKind
- The kind of a relation,
relkind.
Constants§
- BOOTSTRAP_
SUPERUSER BOOTSTRAP_SUPERUSERID, the owner of the built-in objects and of the constructors of a range type.- BTREE
- The OID of the
btreeaccess method. - FIRST_
NORMAL_ OID - The first OID for a user object,
FirstNormalObjectId. - FIRST_
UNPINNED_ OID FirstUnpinnedObjectId. Most objects with a lower OID are pinned, and nopg_dependrow refers to them. Seeis_pinned.- MAX_
COLUMNS MaxHeapAttributeNumber.- PG_
AGGREGATE - The OID of
pg_aggregate. - PG_AM
- The OID of
pg_am. - PG_AMOP
- The OID of
pg_amop. - PG_
AMPROC - The OID of
pg_amproc. - PG_
ATTRDEF - The OID of
pg_attrdef. - PG_CAST
- The OID of the catalog
pg_cast. - PG_
CLASS - The OID of
pg_class, the catalog of relations. - PG_
COLLATION - The OID of the catalog
pg_collation. - PG_
CONSTRAINT - The OID of
pg_constraint. - PG_
DATABASE - The OID of
pg_database. - PG_
DEFAULT_ ACL - The OID of
pg_default_acl. - PG_
EXTENSION - The OID of the catalog
pg_extension. - PG_
LANGUAGE - The OID of the catalog
pg_language. - PG_
LARGEOBJECT - The OID of
pg_largeobject. - PG_
NAMESPACE - The OID of
pg_namespace. - PG_
OPCLASS - The OID of the catalog
pg_opclass. - PG_
OPERATOR - The OID of
pg_operator. - PG_
OPFAMILY - The OID of
pg_opfamily. - PG_PROC
- The OID of
pg_proc. - PG_
REWRITE - The OID of
pg_rewrite. - PG_
STATISTIC_ EXT - The OID of
pg_statistic_ext. - PG_
TABLESPACE - The OID of
pg_tablespace. - PG_
TOAST_ NAMESPACE - The OID of the schema
pg_toast. - PG_
TRIGGER - The OID of the catalog
pg_trigger. - PG_
TS_ CONFIG - The OID of
pg_ts_config. - PG_
TS_ DICT - The OID of
pg_ts_dict. - PG_
TS_ PARSER - The OID of
pg_ts_parser. - PG_
TS_ TEMPLATE - The OID of
pg_ts_template. - PG_TYPE
- The OID of
pg_type. - PUBLIC
- The OID of the schema
public. - TRIGGER_
BEFORE TRIGGER_TYPE_BEFORE. A trigger with neither this bit norTRIGGER_INSTEADfires after the event.- TRIGGER_
DELETE TRIGGER_TYPE_DELETE.- TRIGGER_
INSERT TRIGGER_TYPE_INSERT.- TRIGGER_
INSTEAD TRIGGER_TYPE_INSTEAD.- TRIGGER_
ROW TRIGGER_TYPE_ROW.- TRIGGER_
TRUNCATE TRIGGER_TYPE_TRUNCATE.- TRIGGER_
UPDATE TRIGGER_TYPE_UPDATE.
Functions§
- acl_
new_ owner aclnewowner: the items with the old owner as grantee or grantor get the new owner. When the new owner was in the list before, two items with the same grantee and grantor become one, and an item with no privileges goes away. An item that is not in the text form stays as it is.- collation_
conflict - True when a new collation of the encoding
newcannot have the name of a collation of the encodingexistingin the same schema, asCollationCreatechecks it. A collation of any encoding (-1) conflicts with every collation, and a collation ofUTF8conflicts with a new collation of any encoding. - eliminate_
duplicates eliminate_duplicate_dependencies: the objects ofrefsfrom the highest OID down, without duplicates. A column takes the place of its whole relation, and each other column of the relation stays.- foreign_
key_ function - The place of a function of the foreign keys in the order of
ri_triggers.c, from 0 forRI_FKey_check_insto 11 forRI_FKey_noaction_upd, orNonefor another function. The functions of the referencing table are 0 and 1. For the referenced table, an even place is a function ofDELETEand an odd place a function ofUPDATE. - is_
pinned IsPinnedObject: true for an object that initdb made, except the schemapublic, the databases and the large objects.