Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
51.7. pg_attribute
Prev UpChapter 51. System CatalogsHome Next

51.7. pg_attribute#

The catalogpg_attribute stores information about table columns. There will be exactly onepg_attribute row for every column in every table in the database. (There will also be attribute entries for indexes, and indeed all objects that havepg_class entries.)

The term attribute is equivalent to column and is used for historical reasons.

Table 51.7. pg_attribute Columns

Column Type

Description

attrelidoid (referencespg_class.oid)

The table this column belongs to

attnamename

The column name

atttypidoid (referencespg_type.oid)

The data type of this column (zero for a dropped column)

attlenint2

A copy ofpg_type.typlen of this column's type

attnumint2

The number of the column. Ordinary columns are numbered from 1 up. System columns, such asctid, have (arbitrary) negative numbers.

attcacheoffint4

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

atttypmodint4

atttypmod records type-specific data supplied at table creation time (for example, the maximum length of avarchar column). It is passed to type-specific input functions and length coercion functions. The value will generally be -1 for types that do not needatttypmod.

attndimsint2

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 meansit's an array.)

attbyvalbool

A copy ofpg_type.typbyval of this column's type

attalignchar

A copy ofpg_type.typalign of this column's type

attstoragechar

Normally a copy ofpg_type.typstorage of this column's type. For TOAST-able data types, this can be altered after column creation to control storage policy.

attcompressionchar

The current compression method of the column. Typically this is'\0' to specify use of the current default setting (seedefault_toast_compression). Otherwise,'p' selects pglz compression, while'l' selectsLZ4 compression. However, this field is ignored wheneverattstorage does not allow compression.

attnotnullbool

This represents a not-null constraint.

atthasdefbool

This column has a default expression or generation expression, in which case there will be a corresponding entry in thepg_attrdef catalog that actually defines the expression. (Checkattgenerated to determine whether this is a default or a generation expression.)

atthasmissingbool

This column has a value which is used where the column is entirely missing from the row, as happens when a column is added with a non-volatileDEFAULT value after the row is created. The actual value used is stored in theattmissingval column.

attidentitychar

If a zero byte (''), then not an identity column. Otherwise,a = generated always,d = generated by default.

attgeneratedchar

If a zero byte (''), then not a generated column. Otherwise,s = stored. (Other values might be added in the future.)

attisdroppedbool

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.

attislocalbool

This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously.

attinhcountint2

The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed.

attcollationoid (referencespg_collation.oid)

The defined collation of the column, or zero if the column is not of a collatable data type

attstattargetint2

attstattarget controls the level of detail of statistics accumulated for this column byANALYZE. A zero value indicates that no statistics should be collected. A null 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 ofmost common values to collect, and the target number of histogram bins to create.

attaclaclitem[]

Column-level access privileges, if any have been granted specifically on this column

attoptionstext[]

Attribute-level options, askeyword=value strings

attfdwoptionstext[]

Attribute-level foreign data wrapper options, askeyword=value strings

attmissingvalanyarray

This column has a one element array containing the value used when the column is entirely missing from the row, as happens when the column is added with a non-volatileDEFAULT value after the row is created. The value is only used whenatthasmissing is true. If there is no value the column is null.


In a dropped column'spg_attribute entry,atttypid is reset to zero, butattlen and the other fields copied frompg_type are still valid. This arrangement is needed to cope with the situation where the dropped column's data type was later dropped, and so there is nopg_type row anymore.attlen and the other fields can be used to interpret the contents of a row of the table.


Prev Up Next
51.6. pg_attrdef Home 51.8. pg_authid
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp