Chapter 32. The Information Schema

Table of Contents
32.1. The Schema
32.2. Data Types
32.3. information_schema_catalog_name
32.4. applicable_roles
32.5. check_constraints
32.6. column_domain_usage
32.7. column_privileges
32.8. column_udt_usage
32.9. columns
32.10. constraint_column_usage
32.11. constraint_table_usage
32.12. data_type_privileges
32.13. domain_constraints
32.14. domain_udt_usage
32.15. domains
32.16. element_types
32.17. enabled_roles
32.18. key_column_usage
32.19. parameters
32.20. referential_constraints
32.21. role_column_grants
32.22. role_routine_grants
32.23. role_table_grants
32.24. role_usage_grants
32.25. routine_privileges
32.26. routines
32.27. schemata
32.28. sql_features
32.29. sql_implementation_info
32.30. sql_languages
32.31. sql_packages
32.32. sql_sizing
32.33. sql_sizing_profiles
32.34. table_constraints
32.35. table_privileges
32.36. tables
32.37. triggers
32.38. usage_privileges
32.39. view_column_usage
32.40. view_table_usage
32.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.

32.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.

PRE