Chapter 30. The Information Schema

Table of Contents
30.1. The Schema
30.2. Data Types
30.3. information_schema_catalog_name
30.4. applicable_roles
30.5. check_constraints
30.6. column_domain_usage
30.7. column_privileges
30.8. column_udt_usage
30.9. columns
30.10. constraint_column_usage
30.11. constraint_table_usage
30.12. data_type_privileges
30.13. domain_constraints
30.14. domain_udt_usage
30.15. domains
30.16. element_types
30.17. enabled_roles
30.18. key_column_usage
30.19. parameters
30.20. referential_constraints
30.21. role_column_grants
30.22. role_routine_grants
30.23. role_table_grants
30.24. role_usage_grants
30.25. routine_privileges
30.26. routines
30.27. schemata
30.28. sql_features
30.29. sql_implementation_info
30.30. sql_languages
30.31. sql_packages
30.32. sql_sizing
30.33. sql_sizing_profiles
30.34. table_constraints
30.35. table_privileges
30.36. tables
30.37. triggers
30.38. usage_privileges
30.39. view_column_usage
30.40. view_table_usage
30.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.

30.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 that 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.