columns

The columns view provides information about all table or view columns in the database.

Column name Data type Description
table_catalog sql_identifier The name of the current database containing the table.
table_schema sql_identifier The name of the schema containing the table.
table_name sql_identifier The name of the table.
column_name sql_identifier The name of the column.
ordinal_position cardinal_number The ordinal position of the table column. The count starts at 1.
column_default character_data The default expression of the column.
is_nullable yes_or_no Specifies whether the column is possibly nullable (YES) or not (NO).
data_type character_data The data type of the column. For built-in types, the type name is used.
The possible values are:
  • ARRAY – An array type.
  • USER-DEFINED – A user-defined type. For domain-based columns, the value refers to the underlying type (the domain is identified in domain_name and related columns).
character_maximum_length cardinal_number The declared maximum length if data_type identifies a character or bit string type.
NULL – All other types or if no maximum length is declared.
character_octet_length cardinal_number The maximum possible length, in octets, if data_type identifies a character type.
NULL – All other types.
numeric_precision cardinal_number The declared or implicit precision of numeric types.
NULL – All other data types.
numeric_precision_radix cardinal_number The base (2 or 10) in which numeric precision and scale are expressed.
NULL – Non-numeric data types.
numeric_scale cardinal_number The scale (digits to the right of the decimal) of numeric data types.
NULL – All other data types.
datetime_precision cardinal_number The fractional seconds precision of date/time/timestamp/interval types.
NULL – All other data types.
interval_type character_data Specifies which interval fields are included in interval data types. For example, YEAR TO MONTH.
NULL – A non-interval type.
interval_precision cardinal_number Applies to a feature that is not available in PostgreSQL.
character_set_catalog sql_identifier Applies to a feature that is not available in PostgreSQL.
character_set_schema sql_identifier Applies to a feature that is not available in PostgreSQL.
character_set_name sql_identifier Applies to a feature that is not available in PostgreSQL.
collation_catalog sql_identifier The name of the database containing the column’s collation, or NULL if default or not collatable.
collation_schema sql_identifier The name of the schema containing the column’s collation.
NULL – Default or not collatable.
collation_name sql_identifier The name of the column’s collation.
NULL – Default or not collatable.
domain_catalog sql_identifier The name of the database in which the domain is defined. Applies if the column uses a domain type. Otherwise, NULL.
domain_schema sql_identifier The name of the schema in which the domain is defined. Applies if the column uses a domain type. Otherwise, NULL.
domain_name sql_identifier The name of the domain. Applies if the column uses a domain type. Otherwise, NULL.
udt_catalog sql_identifier The name of the current database where the column’s underlying data type is defined.
udt_schema sql_identifier The name of the schema where the column’s underlying data type is defined.
udt_name sql_identifier The name of the column’s underlying data type.
scope_catalog sql_identifier Applies to a feature that is not available in PostgreSQL.
scope_schema sql_identifier Applies to a feature that is not available in PostgreSQL.
scope_name sql_identifier Applies to a feature that is not available in PostgreSQL.
maximum_cardinality cardinal_number The maximum cardinality of the array.
Always NULL, because arrays in PostgreSQL have unlimited maximum cardinality.
dtd_identifier sql_identifier An identifier for the column’s data type descriptor, guaranteed to be unique in the table.
is_self_referencing yes_or_no Applies to a feature that is not available in PostgreSQL.
is_identity yes_or_no Specifies whether the column is an identity column (YES) or not (NO).
identity_generation character_data Specifies how an identity column generates a value.
The possible values are:
  • ALWAYS – The value is always generated by the system.
  • BY DEFAULT – The system generates a value only when none is provided in an INSERT statement.
identity_start character_data The start value of the identity sequence.
NULL – Not applicable.
identity_increment character_data The increment of the identity sequence.
NULL – Not applicable.
identity_maximum character_data The maximum value of the identity sequence.
NULL – Not applicable.
identity_minimum character_data The minimum value of the identity sequence.
NULL – Not applicable.
identity_cycle yes_or_no Specifies whether the identity sequence cycles (YES) or not (NO).
NULL – Not applicable.
is_generated character_data Specifies how the column value is generated.
The possible values are:
  • ALWAYS – The value is always generated by the system.
  • NEVER – The value is not generated.
generation_expression character_data The generation expression for generated columns.
NULL – Not applicable.
is_updatable yes_or_no Specifies whether the column is updatable (YES) or not (NO).