Chapter 35. The Information Schema
Table of Contents
- 35.1. The Schema
- 35.2. Data Types
- 35.3.
information_schema_catalog_name
- 35.4.
administrable_role_authorizations
- 35.5.
applicable_roles
- 35.6.
attributes
- 35.7.
character_sets
- 35.8.
check_constraint_routine_usage
- 35.9.
check_constraints
- 35.10.
collations
- 35.11.
collation_character_set_applicability
- 35.12.
column_domain_usage
- 35.13.
column_options
- 35.14.
column_privileges
- 35.15.
column_udt_usage
- 35.16.
columns
- 35.17.
constraint_column_usage
- 35.18.
constraint_table_usage
- 35.19.
data_type_privileges
- 35.20.
domain_constraints
- 35.21.
domain_udt_usage
- 35.22.
domains
- 35.23.
element_types
- 35.24.
enabled_roles
- 35.25.
foreign_data_wrapper_options
- 35.26.
foreign_data_wrappers
- 35.27.
foreign_server_options
- 35.28.
foreign_servers
- 35.29.
foreign_table_options
- 35.30.
foreign_tables
- 35.31.
key_column_usage
- 35.32.
parameters
- 35.33.
referential_constraints
- 35.34.
role_column_grants
- 35.35.
role_routine_grants
- 35.36.
role_table_grants
- 35.37.
role_udt_grants
- 35.38.
role_usage_grants
- 35.39.
routine_privileges
- 35.40.
routines
- 35.41.
schemata
- 35.42.
sequences
- 35.43.
sql_features
- 35.44.
sql_implementation_info
- 35.45.
sql_languages
- 35.46.
sql_packages
- 35.47.
sql_parts
- 35.48.
sql_sizing
- 35.49.
sql_sizing_profiles
- 35.50.
table_constraints
- 35.51.
table_privileges
- 35.52.
tables
- 35.53.
transforms
- 35.54.
triggered_update_columns
- 35.55.
triggers
- 35.56.
udt_privileges
- 35.57.
usage_privileges
- 35.58.
user_defined_types
- 35.59.
user_mapping_options
- 35.60.
user_mappings
- 35.61.
view_column_usage
- 35.62.
view_routine_usage
- 35.63.
view_table_usage
- 35.64.
views
- 35.2. Data Types
The information schema consists of a set of views that contain information about the objects defined in the current database. The information schema is defined in the SQL standard and can therefore be expected to be portable and remain stable — unlike the system catalogs, which are specific to PostgreSQL and are modeled after implementation concerns. The information schema views do not, however, contain information about PostgreSQL-specific features; to inquire about those you need to query the system catalogs or other PostgreSQL-specific views.
Note
When querying the database for constraint information, it is possible for a standard-compliant query that expects to return one row to return several. This is because the SQL standard requires constraint names to be unique within a schema, but PostgreSQL does not enforce this restriction. PostgreSQL automatically-generated constraint names avoid duplicates in the same schema, but users can specify such duplicate names.
This problem can appear when querying information schema views such as check_constraint_routine_usage
, check_constraints
, domain_constraints
, and referential_constraints
. Some other views have similar issues but contain the table name to help distinguish duplicate rows, e.g., constraint_column_usage
, constraint_table_usage
, table_constraints
.