-
Notifications
You must be signed in to change notification settings - Fork 504
Catalog Structure
This provides an overview of the code structure and APIs for the catalog.
- Handle, e.g.
NamespaceHandle
. The handle provides methods for the overall table. These include:
- Create (used during initialization)
- Doing lookups, returning an Entry (see below)
- Deleting
- Entry, e.g.
NamespaceEntry
. An entry is a single row result from a lookup, with methods to access the columns by name. The contents of an entry do not change once it has been created.
- creating and deleting databases
- creating and deleting tables
- obtaining handles for the catalogs.
The structure of the catalog tables, is taken from Postgres, with some variance. Detailed information is present in the Postgres documentation. In brief:
-
A
DatabaseHandle
provides access to pg_database. pg_database is global, and records databases. -
A
NamespaceHandle
provides access to pg_namespace. There is a pg_namespace for each database. -
A
TablespaceHandle
provides access to pg_tablespace. This is implemented but not used. -
An
AttributeHandle
provides access to pg_attribute. pg_attribute is per database. There is an entry (i.e. row) for every column in every table. -
A
TypeHandle
provides access to pg_type. pg_type is per database, and records each available type. pg_attribute has foreign key references to pg_type. -
An
AttrDefHandle
provides access to pg_attrdef. pg_attrdef is per database and records default values (where defined) for attributes (i.e. columns). -
A
ClassHandle
provides access to pg_class. pg_class is per database, and has a row for anything that is table like, e.g. tables, indexes, etc. -
A
TableHandle
provides a view equivalent to pg_tables, a simpler view of tables. The API here is different since there are multiple underlying tables.
Carnegie Mellon Database Group Website