Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: devel
Unsupported versions: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

Chapter 37. The Information Schema

Table of Contents

37.1. The Schema
37.2. Data Types
37.3. information_schema_catalog_name
37.4. administrable_role_authorizations
37.5. applicable_roles
37.6. attributes
37.7. character_sets
37.8. check_constraint_routine_usage
37.9. check_constraints
37.10. collations
37.11. collation_character_set_applicability
37.12. column_domain_usage
37.13. column_options
37.14. column_privileges
37.15. column_udt_usage
37.16. columns
37.17. constraint_column_usage
37.18. constraint_table_usage
37.19. data_type_privileges
37.20. domain_constraints
37.21. domain_udt_usage
37.22. domains
37.23. element_types
37.24. enabled_roles
37.25. foreign_data_wrapper_options
37.26. foreign_data_wrappers
37.27. foreign_server_options
37.28. foreign_servers
37.29. foreign_table_options
37.30. foreign_tables
37.31. key_column_usage
37.32. parameters
37.33. referential_constraints
37.34. role_column_grants
37.35. role_routine_grants
37.36. role_table_grants
37.37. role_udt_grants
37.38. role_usage_grants
37.39. routine_privileges
37.40. routines
37.41. schemata
37.42. sequences
37.43. sql_features
37.44. sql_implementation_info
37.45. sql_languages
37.46. sql_packages
37.47. sql_parts
37.48. sql_sizing
37.49. sql_sizing_profiles
37.50. table_constraints
37.51. table_privileges
37.52. tables
37.53. transforms
37.54. triggered_update_columns
37.55. triggers
37.56. udt_privileges
37.57. usage_privileges
37.58. user_defined_types
37.59. user_mapping_options
37.60. user_mappings
37.61. view_column_usage
37.62. view_routine_usage
37.63. view_table_usage
37.64. views

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.