Skip to main content

Crate rupg_catalog

Crate rupg_catalog 

Source
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 of pg_database are 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_* of dependency.c.
names
The names that PostgreSQL makes for objects that a statement does not name, as makeObjectName, ChooseIndexNameAddition and ChooseIndexColumnNames of indexcmds.c make 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_tablespace that CREATE TABLESPACE makes. A tablespace belongs to the cluster, so the store of the server keeps them, as it keeps the rows of pg_database. The rows of pg_default and pg_global are 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.
AttrDefault
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 that pg_import_system_collations makes when the cluster starts.
Column
A column of a relation, one row of pg_attribute with a positive attnum.
Constraint
A constraint, one row of pg_constraint.
DefaultAcl
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_type holds for a type of the kind d.
EnumLabel
A label of an enum type, one row of pg_enum.
Extension
An extension, one row of pg_extension.
ForeignKey
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 of information_schema, or a function that CREATE FUNCTION makes.
FunctionBody
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.
IndexInfo
The facts of an index, one row of pg_index.
Language
A procedural language, one row of pg_language.
MemberLink
The dependency facts of a member of a family, the fields ref_is_hard, ref_is_family and refobjid of OpFamilyMember.
NewDomain
A new domain for Catalog::create_domain.
NewEnum
A new enum type for Catalog::create_enum.
NewForeignKey
A new foreign key before it has an OID.
NewIndex
A new index before it has an OID.
NewIndexColumn
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_depend names 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.
PartitionKey
The partition key of a partitioned table, one row of pg_partitioned_table.
PartitionOf
The parent table and the bound of a partition.
RangeInfo
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 of pg_rewrite. The _RETURN rule of a view is part of ViewInfo, not a Rule.
Schema
A schema.
SequenceData
The row of the file of a sequence, FormData_pg_sequence_data.
SequenceInfo
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, ObjectAddressExtra with its address.
Trigger
A trigger, one row of pg_trigger: a trigger of CREATE 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.
ViewInfo
The query of a view and its _RETURN rule.

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_constraint serves, as addFkConstraint takes it.
PartStrategy
The strategy of a partition key, partstrat.
PartitionBound
The bound of a partition, relpartbound.
RangeDatum
A datum of the bound of a range partition.
RangePart
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 btree access 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 no pg_depend row refers to them. See is_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 nor TRIGGER_INSTEAD fires 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 new cannot have the name of a collation of the encoding existing in the same schema, as CollationCreate checks it. A collation of any encoding (-1) conflicts with every collation, and a collation of UTF8 conflicts with a new collation of any encoding.
eliminate_duplicates
eliminate_duplicate_dependencies: the objects of refs from 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 for RI_FKey_check_ins to 11 for RI_FKey_noaction_upd, or None for another function. The functions of the referencing table are 0 and 1. For the referenced table, an even place is a function of DELETE and an odd place a function of UPDATE.
is_pinned
IsPinnedObject: true for an object that initdb made, except the schema public, the databases and the large objects.