pg_attribute
stores information about table columns. It mimics the pg_attribute PostgreSQL system catalog.
pg_attribute
are applicable to every type of relationpg_attribute
:
Column | Type | Description |
---|---|---|
attrelid | int | This column represents the OID of the table (See pg_class ) |
attname | text | This column represents the column name as specified in CREATE TABLE |
atttypid | int | This column represents the OID of the column type (See pg_type ) |
attnum | int | This column represents the column index (1-based) |
attlen | int | This column represents the byte size of the value (-1 for varying length types) |
attnotnull | bool | This column represents the not-null constraint. true if the column was declared as NOT NULL |
attcacheoff | int | Unused. |
atttypmod | int | Unused. |
attndims | int | Unused. |
attbyval | bool | Unused. |
attalign | text | Unused. |
attstorage | text | Unused. |
attcompression | text | Unused. |
atthasdef | bool | Unused. |
atthasmissing | bool | Unused. |
attidentity | text | Unused. |
attgenerated | text | Unused. |
attisdropped | bool | Unused. |
attislocal | bool | Unused. |
attinhcount | int | Unused. |
attstattarget | int | Unused. |
attcollation | int | Unused. |
attacl | text | Unused. |
attoptions | text | Unused. |
attfdwoptions | text | Unused. |
attmissingval | text | Unused. |
pg_attribute
to retrieve information about all columns across all tables in the database:WHERE
clauses or by limiting the number of rows with LIMIT
clausespg_class.oid
query:pg_attribute
with WHERE
clause:pg_class
is performed to include the name of the table (relname
):