pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。
pg_attribute #目录pg_attribute存储关于表列的信息。数据库中每个表的每一列,在pg_attribute中都恰好有一行。 (其中也包括索引的属性项,实际上,凡是在pg_class中有项的对象,都有对应的属性项。)
术语属性等同于列,这里使用它只是出于历史原因。
表 45.7. pg_attribute 列
| Name | Type | References | Description |
|---|---|---|---|
attrelid |
oid |
|
The table this column belongs to |
attname |
name |
The column name | |
atttypid |
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. A negative value says to use the system default statistics target. 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 |
A copy of pg_type.typlen of 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 row descriptor in memory this might be updated to cache the offset of the attribute within the row | |
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 functions and length coercion functions. The value will generally be -1 for types that do not need atttypmod. |
|
attbyval |
bool |
A copy of pg_type.typbyval of this column's type |
|
attstorage |
char |
Normally a copy of pg_type.typstorage of this column's type. For TOAST-able data types, this can be altered after column creation to control storage policy. |
|
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 column 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. |
|
attisdropped |
bool |
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. | |
attislocal |
bool |
This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously. | |
attinhcount |
int4 |
The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed. | |
attcollation |
oid |
|
The defined collation of the column, or zero if the column is not of a collatable data type. |
attacl |
aclitem[] |
Column-level access privileges, if any have been granted specifically on this column | |
attoptions |
text[] |
Attribute-level options, as “keyword=value” strings |
在被删除列的 pg_attribute 条目中,atttypid 被重置为零,但 attlen 以及其他从 pg_type 复制的字段仍然有效。这种安排用于应对被删除列的数据类型后来也被删除、因而不再有相应 pg_type 行的情况。attlen 和其他字段可用于解释表中一行的内容。
译文有误、术语不当或页面显示问题,请到译文仓库 pgsty/pgdoc 报告译文问题。 英文原文本身的问题,请在当前版本的对应页面向上游反馈;上游不再修订已结束维护的版本。