Chapter 33. The Information Schema

Table of Contents
33.1. The Schema
33.2. Data Types
33.3. information_schema_catalog_name
33.4. administrable_role_authorizations
33.5. applicable_roles
33.6. attributes
33.7. character_sets
33.8. check_constraint_routine_usage
33.9. check_constraints
33.10. collations
33.11. collation_character_set_applicability
33.12. column_domain_usage
33.13. column_options
33.14. column_privileges
33.15. column_udt_usage
33.16. columns
33.17. constraint_column_usage
33.18. constraint_table_usage
33.19. data_type_privileges
33.20. domain_constraints
33.21. domain_udt_usage
33.22. domains
33.23. element_types
33.24. enabled_roles
33.25. foreign_data_wrapper_options
33.26. foreign_data_wrappers
33.27. foreign_server_options
33.28. foreign_servers
33.29. foreign_table_options
33.30. foreign_tables
33.31. key_column_usage
33.32. parameters
33.33. referential_constraints
33.34. role_column_grants
33.35. role_routine_grants
33.36. role_table_grants
33.37. role_udt_grants
33.38. role_usage_grants
33.39. routine_privileges
33.40. routines
33.41. schemata
33.42. sequences
33.43. sql_features
33.44. sql_implementation_info
33.45. sql_languages
33.46. sql_packages
33.47. sql_parts
33.48. sql_sizing
33.49. sql_sizing_profiles
33.50. table_constraints
33.51. table_privileges
33.52. tables
33.53. triggered_update_columns
33.54. triggers
33.55. udt_privileges
33.56. usage_privileges
33.57. user_defined_types
33.58. user_mapping_options
33.59. user_mappings
33.60. view_column_usage
33.61. view_routine_usage
33.62. view_table_usage
33.63. views

Note: XCONLY: The following description applies only to Postgres-XC.

Information schema described in this section holds data only local to a coordinator or a datanode.

Note: The following description applies both to Postgres-XC and PostgreSQL if not described explicitly. You can read PostgreSQL as Postgres-XC except for version number, which is specific to each product.

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.