云数据库 GAUSSDB-DROP RULE:示例

时间:2024-11-02 18:45:41

示例

--创建表def_test、视图def_view_test用于创建RULE
gaussdb=# CREATE TABLE def_test (
c1 int4 DEFAULT 5,
c2 text DEFAULT 'initial_default'
);
gaussdb=# CREATE VIEW def_view_test AS SELECT * FROM def_test;
--创建RULE def_view_test_ins 
gaussdb=# CREATE RULE def_view_test_ins AS
gaussdb=# ON INSERT TO def_view_test
gaussdb=#DO INSTEAD INSERT INTO def_test SELECT new.*;
--删除RULE def_view_test_ins 
gaussdb=# DROP RULE def_view_test_ins ON def_view_test;
--删除表def_test、视图def_view_test
gaussdb=# DROP VIEW def_view_test;
gaussdb=# DROP TABLE def_test;
support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-0630.html