System Catalogs Overview The system catalogs are the place where a relational database management system stores schema metadata, such as information about tables and columns, and internal bookkeeping information. PostgreSQL's system catalogs are regular tables. You can drop and recreate the tables, add columns, insert and update values, and severely mess up your system that way. Normally one should not change the system catalogs by hand, there are always SQL commands to do that. (For example, CREATE DATABASE inserts a row into the pg_database catalog -- and actually creates the database on disk.) There are some exceptions for esoteric operations, such as adding index access methods. System Catalogs Catalog Name Purpose pg_aggregate aggregate functions pg_am index access methods pg_amop access method operators pg_amproc access method support procedures pg_attrdef column default values pg_attribute table columns (attributes, fields) pg_class tables, indexes, sequences (relations) pg_database databases within this database cluster pg_description descriptions or comments on database objects pg_group groups of database users pg_index additional index information pg_inherits table inheritance hierarchy pg_language languages for writing functions pg_largeobject large objects pg_listener asynchronous notification pg_namespace namespaces (schemas) pg_opclass index access method operator classes pg_operator operators pg_proc functions and procedures pg_relcheck check constraints pg_rewrite query rewriter rules pg_shadow database users pg_statistic optimizer statistics pg_trigger triggers pg_type data types
More detailed documentation of most catalogs follow below. The catalogs that relate to index access methods are explained in the Programmer's Guide.
pg_aggregate pg_aggregate stores information about aggregate functions. An aggregate function is a function that operates on a set of values (typically one column from each row that matches a query condition) and returns a single value computed from all these values. Typical aggregate functions are sum, count, and max. Each entry in pg_aggregate is an extension of an entry in pg_proc. The pg_proc entry carries the aggregate's name, input and output datatypes, and other information that is similar to ordinary functions. pg_aggregate Columns Name Type References Description aggfnoid regproc pg_proc.oid pg_proc OID of the aggregate function aggtransfn regproc pg_proc.oid Transition function aggfinalfn regproc pg_proc.oid Final function aggtranstype oid pg_type.oid The type of the aggregate function's internal transition (state) data agginitval text The initial value of the transition state. This is a text field containing the initial value in its external string representation. If the field is NULL, the transition state value starts out NULL.
New aggregate functions are registered with the CREATE AGGREGATE command. See the Programmer's Guide for more information about writing aggregate functions and the meaning of the transition functions, etc.
pg_attrdef This catalog stores column default values. The main information about columns is stored in pg_attribute (see below). Only columns that explicitly specify a default value (when the table is created or the column is added) will have an entry here. pg_attrdef Columns Name Type References Description adrelid oid pg_class.oid The table this column belongs to adnum int2 pg_attribute.attnum The number of the column adbin text An internal representation of the column default value adsrc text A human-readable representation of the default value
pg_attribute pg_attribute stores information about table columns. There will be exactly one pg_attribute row for every column in every table in the database. (There will also be attribute entries for indexes and other objects. See pg_class.) The term attribute is equivalent to column and is used for historical reasons. pg_attribute Columns Name Type References Description attrelid oid pg_class.oid The table this column belongs to attname name Column name atttypid oid pg_type.oid The data type of this column attstattarget int4 attstattarget controls the level of detail of statistics accumulated for this column by ANALYZE. A zero value indicates that no statistics should be collected. The exact meaning of positive values is data type-dependent. For scalar data types, attstattarget is both the target number of most common values to collect, and the target number of histogram bins to create. attlen int2 This is a copy of the pg_type.typlen for this column's type. attnum int2 The number of the column. Ordinary columns are numbered from 1 up. System columns, such as oid, have (arbitrary) negative numbers. attndims int4 Number of dimensions, if the column is an array type; otherwise 0. (Presently, the number of dimensions of an array is not enforced, so any nonzero value effectively means it's an array.) attcacheoff int4 Always -1 in storage, but when loaded into a tuple descriptor in memory this may be updated to cache the offset of the attribute within the tuple. atttypmod int4 atttypmod records type-specific data supplied at table creation time (for example, the maximum length of a varchar column). It is passed to type-specific input and output functions as the third argument. The value will generally be -1 for types that do not need typmod. attbyval bool A copy of pg_type.typbyval of this column's type attstorage char A copy of pg_type.typstorage of this column's type attisset bool If true, this attribute is a set. In that case, what is really stored in the attribute is the OID of a tuple in the pg_proc catalog. The pg_proc tuple contains the query string that defines this set - i.e., the query to run to get the set. So the atttypid (see above) refers to the type returned by this query, but the actual length of this attribute is the length (size) of an oid. --- At least this is the theory. All this is probably quite broken these days. attalign char A copy of pg_type.typalign of this column's type attnotnull bool This represents a NOT NULL constraint. It is possible to change this field to enable or disable the constraint. atthasdef bool This column has a default value, in which case there will be a corresponding entry in the pg_attrdef catalog that actually defines the value.
pg_class pg_class catalogs tables and mostly everything else that has columns or is otherwise similar to a table. This includes indexes (but see also pg_index), sequences, views, and some kinds of special relation. Below, when we mean all of these kinds of objects we speak of relations. Not all fields are meaningful for all relation types. pg_class Columns Name Type References Description relname name Name of the table, index, view, etc. relnamespace oid pg_namespace.oid The OID of the namespace that contains this relation reltype oid pg_type.oid The OID of the data type that corresponds to this table, if any (zero for indexes, which have no pg_type entry) relowner int4 pg_shadow.usesysid Owner of the relation relam oid pg_am.oid If this is an index, the access method used (B-tree, hash, etc.) relfilenode oid Name of the on-disk file of this relation relpages int4 Size of the on-disk representation of this table in pages (size BLCKSZ). This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and CREATE INDEX. reltuples float4 Number of tuples in the table. This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and CREATE INDEX. reltoastrelid oid pg_class.oid OID of the TOAST table associated with this table, 0 if none. The TOAST table stores large attributes out of line in a secondary table. reltoastidxid oid pg_class.oid For a TOAST table, the OID of its index. 0 if not a TOAST table. relhasindex bool True if this is a table and it has (or recently had) any indexes. This is set by CREATE INDEX, but not cleared immediately by DROP INDEX. VACUUM clears relhasindex if it finds the table has no indexes. relisshared bool True if this table is shared across all databases in the cluster. Only certain system catalogs (such as pg_database) are shared. relkind char 'r' = ordinary table, 'i' = index, 'S' = sequence, 'v' = view, 's' = special, 't' = secondary TOAST table relnatts int2 Number of user columns in the relation (system columns not counted). There must be this many corresponding entries in pg_attribute. See also pg_attribute.attnum. relchecks int2 Number of check constraints on the table; see pg_relcheck catalog reltriggers int2 Number of triggers on the table; see pg_trigger catalog relukeys int2 unused (Not the number of unique keys) relfkeys int2 unused (Not the number of foreign keys on the table) relrefs int2 unused relhasoids bool True if we generate an OID for each row of the relation. relhaspkey bool True if the table has (or once had) a primary key. relhasrules bool Table has rules; see pg_rewrite catalog relhassubclass bool At least one table inherits from this one relacl aclitem[] Access permissions. See the descriptions of GRANT and REVOKE for details.
pg_database The pg_database catalog stores information about the available databases. Databases are created with the CREATE DATABASE command. Consult the Administrator's Guide for details about the meaning of some of the parameters. Unlike most system catalogs, pg_database is shared across all databases of a cluster: there is only one copy of pg_database per cluster, not one per database. pg_database Columns Name Type References Description datname name Database name datdba int4 pg_shadow.usesysid Owner of the database, initially who created it encoding int4 Character/multibyte encoding for this database datistemplate bool If true then this database can be used in the TEMPLATE clause of CREATE DATABASE to create a new database as a clone of this one. datallowconn bool If false then no one can connect to this database. This is used to protect the template0 database from being altered. datlastsysoid oid Last system OID in the database; useful particularly to pg_dump datvacuumxid xid All tuples inserted or deleted by transaction IDs before this one have been marked as known committed or known aborted in this database. This is used to determine when commit-log space can be recycled. datfrozenxid xid All tuples inserted by transaction IDs before this one have been relabeled with a permanent (frozen) transaction ID in this database. This is useful to check whether a database must be vacuumed soon to avoid transaction ID wraparound problems. datpath text If the database is stored at an alternative location then this records the location. It's either an environment variable name or an absolute path, depending how it was entered. datconfig text[] Session defaults for run-time configuration variables datacl aclitem[] Access permissions
pg_description The pg_description table can store an optional description or comment for each database object. Descriptions can be manipulated with the COMMENT command. Client applications can view the descriptions by joining with this table. Many built-in system objects have comments associated with them that are shown by psql's \d commands. pg_description Columns Name Type References Description objoid oid any oid attribute The oid of the object this description pertains to classoid oid pg_class.oid The oid of the system catalog this object appears in objsubid int4 For a comment on a table attribute, this is the attribute's column number (the objoid and classoid refer to the table itself). For all other object types, this field is presently zero. description text Arbitrary text that serves as the description of this object.
pg_group This catalog defines groups and stores what users belong to what groups. Groups are created with the CREATE GROUP command. Consult the Administrator's Guide for information about user permission management. Because user and group identities are cluster-wide, pg_group is shared across all databases of a cluster: there is only one copy of pg_group per cluster, not one per database. pg_group Columns Name Type References Description groname name Name of the group grosysid int4 An arbitrary number to identify this group grolist int4[] pg_shadow.usesysid An array containing the ids of the users in this group
pg_index pg_index contains part of the information about indexes. The rest is mostly in pg_class. pg_index Columns Name Type References Description indexrelid oid pg_class.oid The oid of the pg_class entry for this index indrelid oid pg_class.oid The oid of the pg_class entry for the table this index is for indproc regproc pg_proc.oid The registered procedure if this is a functional index indkey int2vector pg_attribute.attnum This is a vector (array) of up to INDEX_MAX_KEYS values that indicate which table columns this index pertains to. For example a value of 1 3 would mean that the first and the third column make up the index key. indclass oidvector pg_opclass.oid For each column in the index key this contains a reference to the operator class to use. See pg_opclass for details. indisclustered bool unused indisunique bool If true, this is a unique index. indisprimary bool If true, this index represents the primary key of the table. (indisunique should always be true when this is true.) indreference oid unused indpred text Expression tree (in the form of a nodeToString representation) for partial index predicate
pg_inherits This catalog records information about table inheritance hierarchies. pg_inherits Columns Name Type References Description inhrelid oid pg_class.oid This is the reference to the subtable, that is, it records the fact that the identified table is inherited from some other table. inhparent oid pg_class.oid This is the reference to the parent table, which the table referenced by inhrelid inherited from. inhseqno int4 If there is more than one parent for a subtable (multiple inheritance), this number tells the order in which the inherited columns are to be arranged. The count starts at 1.
pg_language pg_language registers call interfaces or languages in which you can write functions or stored procedures. See under CREATE LANGUAGE and in the Programmer's Guide for more information about language handlers. pg_language Columns Name Type References Description lanname name Name of the language (to be specified when creating a function) lanispl bool This is false for internal languages (such as SQL) and true for dynamically loaded language handler modules. It essentially means that, if it is true, the language may be dropped. lanpltrusted bool This is a trusted language. See under CREATE LANGUAGE what this means. If this is an internal language (lanispl is false) then this field is meaningless. lanplcallfoid oid pg_proc.oid For non-internal languages this references the language handler, which is a special function that is responsible for executing all functions that are written in the particular language. lanvalidator oid pg_proc.oid This references a language validator function that is responsible for checking the syntax and validity of new functions when they are created. See under CREATE LANGUAGE for further information about validators. lancompiler text not currently used lanacl aclitem[] Access permissions
pg_largeobject pg_largeobject holds the data making up large objects. A large object is identified by an OID assigned when it is created. Each large object is broken into segments or pages small enough to be conveniently stored as rows in pg_largeobject. The amount of data per page is defined to be LOBLKSIZE (which is currently BLCKSZ/4, or typically 2Kbytes). pg_largeobject Columns Name Type References Description loid oid Identifier of the large object that includes this page pageno int4 Page number of this page within its large object (counting from zero) data bytea Actual data stored in the large object. This will never be more than LOBLKSIZE bytes, and may be less.
Each row of pg_largeobject holds data for one page of a large object, beginning at byte offset (pageno * LOBLKSIZE) within the object. The implementation allows sparse storage: pages may be missing, and may be shorter than LOBLKSIZE bytes even if they are not the last page of the object. Missing regions within a large object read as zeroes.
pg_listener pg_listener supports the LISTEN and NOTIFY commands. A listener creates an entry in pg_listener for each notification name it is listening for. A notifier scans pg_listener and updates each matching entry to show that a notification has occurred. The notifier also sends a signal (using the PID recorded in the table) to awaken the listener from sleep. pg_listener Columns Name Type References Description relname name Notify condition name. (The name need not match any actual relation in the database; the term relname is historical.) listenerpid int4 PID of the backend process that created this entry. notification int4 Zero if no event is pending for this listener. If an event is pending, the PID of the backend that sent the notification.
pg_namespace A namespace is the structure underlying SQL92 schemas: each namespace can have a separate collection of relations, types, etc without name conflicts. pg_namespace Columns Name Type References Description nspname name Name of the namespace nspowner int4 pg_shadow.usesysid Owner (creator) of the namespace nspacl aclitem[] Access permissions
pg_operator See CREATE OPERATOR and the Programmer's Guide for details on these operator parameters. pg_operator Columns Name Type References Description oprname name Name of the operator oprnamespace oid pg_namespace.oid The OID of the namespace that contains this operator oprowner int4 pg_shadow.usesysid Owner (creator) of the operator oprprec int2 precedence (currently unused, as precedences are hard-wired in the grammar) oprkind char 'b' = infix (both), 'l' = prefix (left), 'r' = postfix (right) oprisleft bool left-associativity (currently unused, as this is hard-wired in the grammar) oprcanhash bool This operator supports hash joins. oprleft oid pg_type.oid Type of the left operand oprright oid pg_type.oid Type of the right operand oprresult oid pg_type.oid Type of the result oprcom oid pg_operator.oid Commutator of this operator, if any oprnegate oid pg_operator.oid Negator of this operator, if any oprlsortop oid pg_operator.oid If this operator supports merge joins, the operator that sorts the type of the left-hand operand (L<L) oprrsortop oid pg_operator.oid If this operator supports merge joins, the operator that sorts the type of the right-hand operand (R<R) oprltcmpop oid pg_operator.oid If this operator supports merge joins, the less-than operator that compares the left and right operand types (L<R) oprgtcmpop oid pg_operator.oid If this operator supports merge joins, the greater-than operator that compares the left and right operand types (L>R) oprcode regproc pg_proc.oid Function that implements this operator oprrest regproc pg_proc.oid Restriction selectivity estimation function for this operator oprjoin regproc pg_proc.oid Join selectivity estimation function for this operator
pg_proc This catalog stores information about functions (or procedures). The description of CREATE FUNCTION and the Programmer's Guide contain more information about the meaning of some fields. The table contains data for aggregate functions as well as plain functions. If proisagg is true, there should be a matching row in pg_aggregate. pg_proc Columns Name Type References Description proname name Name of the function pronamespace oid pg_namespace.oid The OID of the namespace that contains this function proowner int4 pg_shadow.usesysid Owner (creator) of the function prolang oid pg_language.oid Implementation language or call interface of this function proisagg bool Function is an aggregate function proistrusted bool not functional proimplicit bool Function may be invoked as an implicit type coercion proisstrict bool Function returns null if any call argument is null. In that case the function won't actually be called at all. Functions that are not strict must be prepared to handle null inputs. proretset bool Function returns a set (ie, multiple values of the specified data type) provolatile char provolatile tells whether the function's result depends only on its input arguments, or is affected by outside factors. It is i for immutable functions, which always deliver the same result for the same inputs. It is s for stable functions, whose results (for fixed inputs) do not change within a scan. It is v for volatile functions, whose results may change at any time. (Use v also for functions with side-effects, so that calls to them cannot get optimized away.) pronargs int2 Number of arguments prorettype oid pg_type.oid Data type of the return value (0 if the function does not return a value) proargtypes oidvector pg_type.oid A vector with the data types of the function arguments probyte_pct int4 dead code properbyte_cpu int4 dead code propercall_cpu int4 dead code prooutin_ratio int4 dead code prosrc text This tells the function handler how to invoke the function. It might be the actual source code of the function for interpreted languages, a link symbol, a file name, or just about anything else, depending on the implementation language/call convention. probin bytea Additional information about how to invoke the function. Again, the interpretation is language-specific. proacl aclitem[] Access permissions
Currently, prosrc contains the function's C-language name (link symbol) for compiled functions, both built-in and dynamically loaded. For all other language types, prosrc contains the function's source text. Currently, probin is unused except for dynamically-loaded C functions, for which it gives the name of the shared library file containing the function.
pg_relcheck This system catalog stores CHECK constraints on tables. (Column constraints are not treated specially. Every column constraint is equivalent to some table constraint.) See under CREATE TABLE for more information. pg_relcheck Columns Name Type References Description rcrelid oid pg_class.oid The table this check constraint is on rcname name Constraint name rcbin text An internal representation of the constraint expression rcsrc text A human-readable representation of the constraint expression
pg_class.relchecks needs to match up with the entries in this table.
pg_rewrite This system catalog stores rewrite rules for tables and views. pg_rewrite Columns Name Type References Description rulename name Rule name ev_type char Event type that the rule is for: '1' = SELECT, '2' = UPDATE, '3' = INSERT, '4' = DELETE ev_class oid pg_class.oid The table this rule is for ev_attr int2 The column this rule is for (currently, always zero to indicate the whole table) is_instead bool True if the rule is an INSTEAD rule ev_qual text Expression tree (in the form of a nodeToString representation) for the rule's qualifying condition ev_action text Query tree (in the form of a nodeToString representation) for the rule's action
pg_class.relhasrules must be true if a table has any rules in this catalog.
pg_shadow pg_shadow contains information about database users. The name stems from the fact that this table should not be readable by the public since it contains passwords. pg_user is a publicly readable view on pg_shadow that blanks out the password field. The Administrator's Guide contains detailed information about user and permission management. Because user identities are cluster-wide, pg_shadow is shared across all databases of a cluster: there is only one copy of pg_shadow per cluster, not one per database. pg_shadow Columns Name Type References Description usename name User name usesysid int4 User id (arbitrary number used to reference this user) usecreatedb bool User may create databases usetrace bool not used usesuper bool User is a superuser usecatupd bool User may update system catalogs. (Even a superuser may not do this unless this attribute is true.) passwd text Password valuntil abstime Account expiry time (only used for password authentication) useconfig text[] Session defaults for run-time configuration variables
pg_statistic pg_statistic stores statistical data about the contents of the database. Entries are created by ANALYZE and subsequently used by the query planner. There is one entry for each table column that has been analyzed. Note that all the statistical data is inherently approximate, even assuming that it is up-to-date. Since different kinds of statistics may be appropriate for different kinds of data, pg_statistic is designed not to assume very much about what sort of statistics it stores. Only extremely general statistics (such as NULL-ness) are given dedicated columns in pg_statistic. Everything else is stored in slots, which are groups of associated columns whose content is identified by a code number in one of the slot's columns. For more information see src/include/catalog/pg_statistic.h. pg_statistic should not be readable by the public, since even statistical information about a table's contents may be considered sensitive. (Example: minimum and maximum values of a salary column might be quite interesting.) pg_stats is a publicly readable view on pg_statistic that only exposes information about those tables that are readable by the current user. pg_stats is also designed to present the information in a more readable format than the underlying pg_statistic table --- at the cost that its schema must be extended whenever new slot types are added. pg_statistic Columns Name Type References Description starelid oid pg_class.oid The table that the described column belongs to staattnum int2 pg_attribute.attnum The number of the described column stanullfrac float4 The fraction of the column's entries that are NULL stawidth int4 The average stored width, in bytes, of non-NULL entries stadistinct float4 The number of distinct non-NULL data values in the column. A value greater than zero is the actual number of distinct values. A value less than zero is the negative of a fraction of the number of rows in the table (for example, a column in which values appear about twice on the average could be represented by stadistinct = -0.5). A zero value means the number of distinct values is unknown. stakindN int2 A code number indicating the kind of statistics stored in the Nth slot of the pg_statistic row. staopN oid pg_operator.oid An operator used to derive the statistics stored in the Nth slot. For example, a histogram slot would show the < operator that defines the sort order of the data. stanumbersN float4[] Numerical statistics of the appropriate kind for the Nth slot, or NULL if the slot kind does not involve numerical values. stavaluesN text[] Column data values of the appropriate kind for the Nth slot, or NULL if the slot kind does not store any data values. For data-type independence, all column data values are converted to external textual form and stored as TEXT datums.
pg_trigger This system catalog stores triggers on tables. See under CREATE TRIGGER for more information. pg_trigger Columns Name Type References Description tgrelid oid pg_class.oid The table this trigger is on tgname name Trigger name (need not be unique) tgfoid oid pg_proc.oid The function to be called tgtype int2 Bitmask identifying trigger conditions tgenabled bool True if trigger is enabled (not presently checked everywhere it should be, so disabling a trigger by setting this false does not work reliably) tgisconstraint bool True if trigger is a RI constraint tgconstrname name RI constraint name tgconstrrelid oid pg_class.oid The table referenced by an RI constraint tgdeferrable bool True if deferrable tginitdeferred bool True if initially deferred tgnargs int2 Number of argument strings passed to trigger function tgattr int2vector Currently unused tgargs bytea Argument strings to pass to trigger, each null-terminated
pg_class.reltriggers needs to match up with the entries in this table.
pg_type This catalog stores information about data types. Scalar types (base types) are created with CREATE TYPE. A complex type is also created for each table in the database, to represent the row structure of the table. It is also possible to create derived types with CREATE DOMAIN. pg_type Columns Name Type References Description typname name Data type name typnamespace oid pg_namespace.oid The OID of the namespace that contains this type typowner int4 pg_shadow.usesysid Owner (creator) of the type typlen int2 Length of the storage representation of the type, -1 if variable length typprtlen int2 unused typbyval bool typbyval determines whether internal routines pass a value of this type by value or by reference. Only char, short, and int equivalent items can be passed by value, so if the type is not 1, 2, or 4 bytes long, PostgreSQL does not have the option of passing by value and so typbyval had better be false. Variable-length types are always passed by reference. Note that typbyval can be false even if the length would allow pass-by-value; this is currently true for type float4, for example. typtype char typtype is b for a base type, c for a complex type (i.e., a table's row type), or d for a derived type (i.e., a domain). See also typrelid and typbasetype. typisdefined bool True if the type is defined, false if this is a placeholder entry for a not-yet-defined type. When typisdefined is false, nothing except the type name and OID can be relied on. typdelim char Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type. typrelid oid pg_class.oid If this is a complex type (see typtype), then this field points to the pg_class entry that defines the corresponding table. A table could theoretically be used as a composite data type, but this is not fully functional. Zero for non-complex types. typelem oid pg_type.oid If typelem is not 0 then it identifies another row in pg_type. The current type can then be subscripted like an array yielding values of type typelem. A true array type is variable length (typlen = -1), but some fixed-length (typlen > 0) types also have nonzero typelem, for example name and oidvector. If a fixed-length type has a typelem then its internal representation must be N values of the typelem data type with no other data. Variable-length array types have a header defined by the array subroutines. typinput regproc pg_proc.oid Input function typoutput regproc pg_proc.oid Output function typreceive regproc pg_proc.oid unused typsend regproc pg_proc.oid unused typalign char typalign is the alignment required when storing a value of this type. It applies to storage on disk as well as most representations of the value inside PostgreSQL. When multiple values are stored consecutively, such as in the representation of a complete row on disk, padding is inserted before a datum of this type so that it begins on the specified boundary. The alignment reference is the beginning of the first datum in the sequence. Possible values are: 'c' = CHAR alignment, i.e., no alignment needed. 's' = SHORT alignment (2 bytes on most machines). 'i' = INT alignment (4 bytes on most machines). 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all). For types used in system tables, it is critical that the size and alignment defined in pg_type agree with the way that the compiler will lay out the field in a struct representing a table row. typstorage char typstorage tells for variable-length types (those with typlen = -1) if the type is prepared for toasting and what the default strategy for attributes of this type should be. Possible values are 'p': Value must always be stored plain. 'e': Value can be stored in a secondary relation (if relation has one, see pg_class.reltoastrelid). 'm': Value can be stored compressed inline. 'x': Value can be stored compressed inline or in secondary. Note that 'm' fields can also be moved out to secondary storage, but only as a last resort ('e' and 'x' fields are moved first). typnotnull bool typnotnull represents a NOT NULL constraint on a type. Presently used for domains only. typbasetype oid pg_type.oid If this is a derived type (see typtype), then typbasetype identifies the type that this one is based on. Zero if not a derived type. typtypmod int4 typtypmod records type-specific data supplied at table creation time (for example, the maximum length of a varchar column). It is passed to type-specific input and output functions as the third argument. The value will generally be -1 for types that do not need typmod. This value is copied to pg_attribute.atttypmod when creating a column of a domain type. typndims int4 typndims is the number of array dimensions for a domain that is an array. (The array element type is typbasetype.) Zero for non-domains and non-array domains. This value is copied to pg_attribute.attndims when creating a column of a domain type. typdefaultbin text If typdefaultbin is not NULL, it is the nodeToString representation of a default expression for the type. Currently this is only used for domains. typdefault text typdefault is NULL if the type has no associated default value. If typdefaultbin is not NULL, typdefault must contain a human-readable version of the default expression represented by typdefaultbin. If typdefaultbin is NULL and typdefault is not, then typdefault is the external representation of the type's default value, which may be fed to the type's input converter to produce a constant.