数据仓库服务 GAUSSDB(DWS)-ALTER VIEW:示例

时间:2024-12-24 10:32:39

示例

创建示例视图myview:

1
2
CREATE OR REPLACE VIEW myview AS
    SELECT * FROM pg_tablespace WHERE spcname = 'pg_default';

修改视图名称:

1
ALTER VIEW myview RENAME TO product_view;

修改视图所属schema:

1
ALTER VIEW product_view SET schema public;

重建视图(需设置GUC参数view_independent为on):

1
ALTER VIEW public.product_view REBUILD;

重建依赖视图(需设置GUC参数view_independent为on):

1
ALTER VIEW ONLY public.product_view REBUILD;
support.huaweicloud.com/sqlreference-dws/dws_06_0150.html