ALTER MATERIALIZED VIEW

用于修改物化视图定义的 SQL 命令

ALTER MATERIALIZED VIEW 是一个 DDL 命令,用于修改物化视图的定义。

ALTER MATERIALIZED VIEW 添加于 PostgreSQL 9.3

更改历史

示例

ALTER MATERIALIZED VIEW 的基本用法示例

postgres=# CREATE TABLE foo (id INT, val TEXT);
CREATE TABLE

postgres=# INSERT INTO foo VALUES(1, 'bar');
INSERT 0 1

postgres=# CREATE MATERIALIZED VIEW bar AS SELECT * FROM foo;
SELECT 1

postgres=# \d bar
          Materialized view "public.bar"
 Column |  Type   | Collation | Nullable | Default 
--------+---------+-----------+----------+---------
 id     | integer |           |          | 
 val    | text    |           |          | 

postgres=# ALTER MATERIALIZED VIEW bar RENAME val TO foo_val;
ALTER MATERIALIZED VIEW

postgres=# \d bar
           Materialized view "public.bar"
 Column  |  Type   | Collation | Nullable | Default 
---------+---------+-----------+----------+---------
 id      | integer |           |          | 
 foo_val | text    |           |          | 

分类

DDL

参见

REFRESH MATERIALIZED VIEWCREATE MATERIALIZED VIEWDROP MATERIALIZED VIEW

反馈

请在此处提交关于 "ALTER MATERIALIZED VIEW" 的任何评论、建议或更正 此处