PostgreSQL 8.4.7 Documentation
Prev | Fast Backward | Chapter 33. The Information Schema | Fast Forward | Next

# 33.6. `attributes`

The view `attributes` contains information about the attributes of composite data types defined in the database. (Note that the view does not give information about table columns, which are sometimes called attributes in PostgreSQL contexts.)

Table 33-4. `attributes` Columns

Name | Data Type | Description
--- | --- | ---
`udt_catalog` | `sql_identifier` | Name of the database containing the data type (always the current database)
`udt_schema` | `sql_identifier` | Name of the schema containing the data type
`udt_name` | `sql_identifier` | Name of the data type
`attribute_name` | `sql_identifier` | Name of the attribute
`ordinal_position` | `cardinal_number` | Ordinal position of the attribute within the data type (count starts at 1)
`attribute_default` | `character_data` | Default expression of the attribute
`is_nullable` | `character_data` | `YES` if the attribute is possibly nullable, `NO` if it is known not nullable.
`data_type` | `character_data` | Data type of the attribute, if it is a built-in type, or `ARRAY` if it is some array (in that case, see the view `element_types`), else `USER-DEFINED` (in that case, the type is identified in `attribute_udt_name` and associated columns).
`character_maximum_length` | `cardinal_number` | If `data_type` identifies a character or bit string type, the declared maximum length; null for all other data types or if no maximum length was declared.
`character_octet_length` | `cardinal_number` | If `data_type` identifies a character type, the maximum possible length in octets (bytes) of a datum (this should not be of concern to PostgreSQL users); null for all other data types.
`numeric_precision` | `cardinal_number` | If `data_type` identifies a numeric type, this column contains the (declared or implicit) precision of the type for this attribute. The precision indicates the number of significant digits. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column `numeric_precision_radix`. For all other data types, this column is null.
`numeric_precision_radix` | `cardinal_number` | If `data_type` identifies a numeric type, this column indicates in which base the values in the columns `numeric_precision` and `numeric_scale` are expressed. The value is either 2 or 10. For all other data types, this column is null.

`numeric_scale`

`cardinal_number`

If `data_type` identifies an exact numeric type, this column contains the (declared or implicit) scale of the type for this attribute. The scale indicates the number of significant digits to the right of the decimal point. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column `numeric_precision_radix`. For all other data types, this column is null.

`datetime_precision` | `cardinal_number` | If `data_type` identifies a date, time, timestamp, or interval type, this column contains the (declared or implicit) fractional seconds precision of the type for this attribute, that is, the number of decimal digits maintained following the decimal point in the seconds value. For all other data types, this column is null.
`interval_type` | `character_data` | Not yet implemented
`interval_precision` | `character_data` | Not yet implemented
`attribute_udt_catalog` | `sql_identifier` | Name of the database that the attribute data type is defined in (always the current database)
`attribute_udt_schema` | `sql_identifier` | Name of the schema that the attribute data type is defined in
`attribute_udt_name` | `sql_identifier` | Name of the attribute data type
`scope_catalog` | `sql_identifier` | Applies to a feature not available in PostgreSQL
`scope_schema` | `sql_identifier` | Applies to a feature not available in PostgreSQL
`scope_name` | `sql_identifier` | Applies to a feature not available in PostgreSQL
`maximum_cardinality` | `cardinal_number` | Always null, because arrays always have unlimited maximum cardinality in PostgreSQL
`dtd_identifier` | `sql_identifier` | An identifier of the data type descriptor of the column, unique among the data type descriptors pertaining to the table. This is mainly useful for joining with other instances of such identifiers. (The specific format of the identifier is not defined and not guaranteed to remain the same in future versions.)
`is_derived_reference_attribute` | `character_data` | Applies to a feature not available in PostgreSQL

See also under Section 33.12, a similarly structured view, for further information on some of the columns.

Prev | Home | Next
`applicable_roles` | Up | `check_constraint_routine_usage`