• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Systems Tables and Views
  5. PG_ATTRIBUTE

PG_ATTRIBUTE

PG_ATTRIBUTE stores information about table columns.

Table 1 PG_ATTRIBUTE columns

Name

Type

Description

attrelid

oid

Table to which the column belongs

attname

name

Column name

atttypid

oid

Column type

attstattarget

integer

Level of details of statistics collected 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

smallint

Copy of pg_type.typlen in the column's type

attnum

smallint

Number of a column.

attndims

integer

Number of dimensions if the column is an array; otherwise, the value is 0.

attcacheoff

integer

This column is always -1 on disk. When it is loaded into a row descriptor in the memory, it may be updated to cache the offset of the columns in the row.

atttypmod

integer

Type-specific data supplied at table creation time (for example, the maximum length of a varchar column). This column is used as the third parameter when passing to type-specific input functions and length coercion functions. The value will generally be -1 for types that do not need ATTTYPMOD.

attbyval

Boolean

Copy of pg_type.typbyval of this column's type

attstorage

"char"

Copy of pg_type.typstorage of this column's type

attalign

"char"

Copy of pg_type.typalign of this column's type

attnotnull

Boolean

A not-null constraint. It is possible to change this column to enable or disable the constraint.

atthasdef

Boolean

This column has a default value, in which case there will be a corresponding entry in the pg_attrdef table that actually defines the value.

attisdropped

Boolean

Indicates that this column has been deleted and is no longer valid. A deleted column is still physically present in the table but is ignored by the analyzer, so it cannot be accessed through SQL.

attislocal

Boolean

Indicates that this column is locally defined in the relationship. Note that a column can be locally defined and inherited simultaneously.

attcmprmode

tinyint

Compressed modes for a specific column The compressed mode includes:

  • ATT_CMPR_NOCOMPRESS
  • ATT_CMPR_DELTA
  • ATT_CMPR_DICTIONARY
  • ATT_CMPR_PREFIX
  • ATT_CMPR_NUMSTR

attinhcount

integer

Number of direct ancestors this column has. A column with an ancestor cannot be dropped nor renamed.

attcollation

oid

Defined collation of a column

attacl

aclitem[]

Permissions for column-level access

attoptions

text[]

Property-level options

attfdwoptions

text[]

Property-level external data options

attinitdefval

bytea

attinitdefval stores the default value expression. ADD COLUMN in a row-store table must use this column.