pg_attribute
pg_attribute#
The pg_attribute table 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 all objects that have pg_class_internal entries.) The term attribute is equivalent to column.
Table 1. pg_catalog.pg_attribute
column |
type |
references |
description |
|---|---|---|---|
|
oid |
pg_class_internal.oid |
The table this column belongs to |
|
name |
The column name |
|
|
oid |
pg_type.oid |
The data type of this column |
|
integer |
Controls the level of detail of statistics accumulated for this column by |
|
|
smallint |
A copy of pg_type.typlen of this column’s type. |
|
|
smallint |
The number of the column. Ordinary columns are numbered from 1 up. System columns, such as oid, have (arbitrary) negative numbers. |
|
|
integer |
Number of dimensions, if the column is an array type; otherwise |
|
|
integer |
Always |
|
|
integer |
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 functions and length coercion functions. The value will generally be |
|
|
boolean |
A copy of pg_type.typbyval of this column’s type |
|
|
char |
Normally a copy of |
|
|
char |
A copy of |
|
|
boolean |
This represents a not-null constraint. It is possible to change this column to enable or disable the constraint. |
|
|
boolean |
This column has a default value, in which case there will be a corresponding entry in the |
|
|
boolean |
This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL |
|
|
boolean |
This column is defined locally in the relation. Note that a column may be locally defined and inherited simultaneously |
|
|
integer |
The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed |