【问题标题】:Postgres: see query used to create materialized view?Postgres:查看用于创建物化视图的查询?
【发布时间】:2015-03-27 21:31:06
【问题描述】:

我正在使用 Postgres 9.4。有什么方法可以查看用于创建物化视图的查询?

在做:

# \d my_view;

只显示视图的列名和索引,而不是用于创建它的命令。我在the docs 中看不到任何关于此的内容。

感谢您的帮助。

【问题讨论】:

标签: postgresql


【解决方案1】:

这存储在pg_matviews:

select definition
from pg_matview
where matviewname = 'my_view'
and schemaname = 'public';

您也可以按照 Craig 的建议使用 pg_get_viewdef()

select pg_get_viewdef('public.my_view', true);

【讨论】:

    猜你喜欢
    • 2019-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-04
    • 2011-05-15
    • 1970-01-01
    • 2019-06-06
    相关资源
    最近更新 更多