是否可以更改物化视图中的列类型?
Is it possible to change column type in a materialized view?
我很确定不是:
ALTER MATERIALIZED VIEW myview ALTER COLUMN quantity SET TYPE integer;
产生:
ERROR: "myview" is not a table, composite type, or foreign table
但只是想检查一下我没有 missed something in the documentation。
物化视图中列的数据类型派生自与 mview 一起存储的 SELECT 语句。
要更改此类列的数据类型,您需要在 SELECT 中添加适当的 cast
,然后刷新 mview。
我很确定不是:
ALTER MATERIALIZED VIEW myview ALTER COLUMN quantity SET TYPE integer;
产生:
ERROR: "myview" is not a table, composite type, or foreign table
但只是想检查一下我没有 missed something in the documentation。
物化视图中列的数据类型派生自与 mview 一起存储的 SELECT 语句。
要更改此类列的数据类型,您需要在 SELECT 中添加适当的 cast
,然后刷新 mview。