信息模式

一个包含数据库对象元数据的特殊模式

information schema 是一个特殊的模式,其中包含当前数据库中定义的对象的标准视图。

information schemaPostgreSQL 7.4 中引入。

用法

information schema 提供了一种几乎符合 SQL 标准的方式来访问 PostgreSQL 数据库对象的元数据,该方式在主要版本之间应该是稳定的。这比通过 PostgreSQL 的 系统目录 表和视图可用的接口更稳定,但它不包含关于 PostgreSQL 特有功能的信息。

变更历史

进行中

示例

information_schema.tables 视图公开的表的基元数据

postgres=# CREATE TABLE foo (id int);
CREATE TABLE

postgres=# SELECT * FROM information_schema.tables WHERE table_name='foo';
-[ RECORD 1 ]----------------+-----------
table_catalog                | postgres
table_schema                 | public
table_name                   | foo
table_type                   | BASE TABLE
self_referencing_column_name | 
reference_generation         | 
user_defined_type_catalog    | 
user_defined_type_schema     | 
user_defined_type_name       | 
is_insertable_into           | YES
is_typed                     | NO
commit_action                | 

分类

系统目录

反馈

Information schema”的任何评论、建议或更正,请在此 提交