バージョンごとのドキュメント一覧

第37章 情報スキーマ

目次

37.1. スキーマ
37.2. データ型
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_column_usage
37.13. column_domain_usage
37.14. column_options
37.15. column_privileges
37.16. column_udt_usage
37.17. columns
37.18. constraint_column_usage
37.19. constraint_table_usage
37.20. data_type_privileges
37.21. domain_constraints
37.22. domain_udt_usage
37.23. domains
37.24. element_types
37.25. enabled_roles
37.26. foreign_data_wrapper_options
37.27. foreign_data_wrappers
37.28. foreign_server_options
37.29. foreign_servers
37.30. foreign_table_options
37.31. foreign_tables
37.32. key_column_usage
37.33. parameters
37.34. referential_constraints
37.35. role_column_grants
37.36. role_routine_grants
37.37. role_table_grants
37.38. role_udt_grants
37.39. role_usage_grants
37.40. routine_column_usage
37.41. routine_privileges
37.42. routine_routine_usage
37.43. routine_sequence_usage
37.44. routine_table_usage
37.45. routines
37.46. schemata
37.47. sequences
37.48. sql_features
37.49. sql_implementation_info
37.50. sql_parts
37.51. sql_sizing
37.52. table_constraints
37.53. table_privileges
37.54. tables
37.55. transforms
37.56. triggered_update_columns
37.57. triggers
37.58. udt_privileges
37.59. usage_privileges
37.60. user_defined_types
37.61. user_mapping_options
37.62. user_mappings
37.63. view_column_usage
37.64. view_routine_usage
37.65. view_table_usage
37.66. views
<title>The Information Schema</title>

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 &mdash; unlike the system catalogs, which are specific to <productname>PostgreSQL</productname> and are modeled after implementation concerns. The information schema views do not, however, contain information about <productname>PostgreSQL</productname>-specific features; to inquire about those you need to query the system catalogs or other <productname>PostgreSQL</productname>-specific views. 情報スキーマは、現在のデータベースで定義されたオブジェクトについての情報を持つビューの集合から構成されます。 情報スキーマは標準SQLで定義されています。 したがって、PostgreSQLに特化し、実装上の事項にならって作成されるシステムカタログとは異なり、移植性があり、安定性を保持できるものと期待できます。 しかし、情報スキーマのビューには、PostgreSQL固有の機能についての情報が含まれていません。 これに問い合わせを行うためには、システムカタログもしくはPostgreSQL固有のビューに問い合わせを行う必要があります。

注記

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 <productname>PostgreSQL</productname> does not enforce this restriction. <productname>PostgreSQL</productname> automatically-generated constraint names avoid duplicates in the same schema, but users can specify such duplicate names. 制約情報についてデータベースに問い合わせるとき、一行を返すことが想定される標準に準拠したクエリが数行の結果を返す場合があります。 これは、制約名がスキーマ内で一意になることをSQL標準が要求しているのに対して、PostgreSQLはこの制約を強制しないためです。 PostgreSQLは自動生成される制約の名前がスキーマ内で重複することを防ぎますが、ユーザは重複する名前を指定できます。

This problem can appear when querying information schema views such as <literal>check_constraint_routine_usage</literal>, <literal>check_constraints</literal>, <literal>domain_constraints</literal>, and <literal>referential_constraints</literal>. Some other views have similar issues but contain the table name to help distinguish duplicate rows, e.g., <literal>constraint_column_usage</literal>, <literal>constraint_table_usage</literal>, <literal>table_constraints</literal>. この問題は、check_constraint_routine_usagecheck_constraintsdomain_constraintsreferential_constraintsといった情報スキーマビューを検索するときに表面化することがあります。 いくつかの他のビューにも同様の問題がありますが、重複行を識別する助けになるテーブル名を含んでいます。例えばconstraint_column_usageconstraint_table_usagetable_constraintsなどです。