Chapter 33. The Information Schema

Table of Contents
33.1. The Schema
33.2. Data Types
33.3. information_schema_catalog_name
33.4. applicable_roles
33.5. check_constraints
33.6. column_domain_usage
33.7. column_privileges
33.8. column_udt_usage
33.9. columns
33.10. constraint_column_usage
33.11. constraint_table_usage
33.12. data_type_privileges
33.13. domain_constraints
33.14. domain_udt_usage
33.15. domains
33.16. element_types
33.17. enabled_roles
33.18. key_column_usage
33.19. parameters
33.20. referential_constraints
33.21. role_columns_grants
33.22. role_routine_grants
33.23. role_table_grants
33.24. role_usage_grants
33.25. routine_privileges
33.26. routines
33.27. schemata
33.28. sql_features
33.29. sql_implementation_info
33.30. sql_languages
33.31. sql_packages
33.32. sql_sizing
33.33. sql_sizing_profiles
33.34. table_constraints
33.35. table_privileges
33.36. tables
33.37. triggers
33.38. usage_privileges
33.39. view_column_usage
33.40. view_table_usage
33.41. 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 modelled 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.

33.1. The Schema

The information schema itself is a schema named information_schema. This schema automatically exists in all databases. The owner of this schema is the initial database user in the cluster, and that user naturally has all the privileges on this schema, including the ability to drop it (but the space savings achieved by this are minuscule).

By default, the information schema is not in the schema search path, so you need to access all objects in it through qualified names. Since the names of some of the objects in the information schema are generic names that might occur in user applications, you should be careful if you want to put the information schema in the path.