pg_matviews
是一个列出可用物化视图的系统目录视图。
pg_matviews
是在PostgreSQL 9.3中添加的。
按PostgreSQL版本定义
pg_matviews (PostgreSQL 17)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 16)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 15)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 14)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 13)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 12)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 11)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 10)
View "pg_catalog.pg_matviews" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- schemaname | name | | | matviewname | name | | | matviewowner | name | | | tablespace | name | | | hasindexes | boolean | | | ispopulated | boolean | | | definition | text | | |
文档: pg_matviews
pg_matviews (PostgreSQL 9.6)
View "pg_catalog.pg_matviews" Column | Type | Modifiers --------------+---------+----------- schemaname | name | matviewname | name | matviewowner | name | tablespace | name | hasindexes | boolean | ispopulated | boolean | definition | text |
文档: pg_matviews
pg_matviews (PostgreSQL 9.5)
View "pg_catalog.pg_matviews" Column | Type | Modifiers --------------+---------+----------- schemaname | name | matviewname | name | matviewowner | name | tablespace | name | hasindexes | boolean | ispopulated | boolean | definition | text |
文档: pg_matviews
pg_matviews (PostgreSQL 9.4)
View "pg_catalog.pg_matviews" Column | Type | Modifiers --------------+---------+----------- schemaname | name | matviewname | name | matviewowner | name | tablespace | name | hasindexes | boolean | ispopulated | boolean | definition | text |
文档: pg_matviews
pg_matviews (PostgreSQL 9.3)
View "pg_catalog.pg_matviews" Column | Type | Modifiers --------------+---------+----------- schemaname | name | matviewname | name | matviewowner | name | tablespace | name | hasindexes | boolean | ispopulated | boolean | definition | text |
文档: pg_matviews
更改历史记录
自该视图在PostgreSQL 9.3中添加以来,它没有被修改过。
- PostgreSQL 9.3
- 添加 (提交 3bf3ab8c)
示例
postgres=# CREATE TABLE foo (id int); CREATE TABLE postgres=# CREATE MATERIALIZED VIEW bar AS SELECT * FROM foo; SELECT 0 postgres=# SELECT * FROM pg_matviews ; schemaname | matviewname | matviewowner | tablespace | hasindexes | ispopulated | definition ------------+-------------+--------------+------------+------------+-------------+---------------- public | bar | postgres | | f | t | SELECT foo.id+ | | | | | | FROM foo; (1 row)
参考文献
- PostgreSQL文档: pg_matviews