DROP RULE
Description
Drops a rewriting rule.
Syntax
DROP RULE [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
Parameters
- IF EXISTS
If the rule does not exist, a NOTICE is thrown.
- name
Name of an existing rule to be dropped.
- table_name
Name of the table to which the rule applies.
- CASCADE
Automatically cascade drops objects that depend on this rule.
- RESTRICT
Refuses to drop the rule if any objects depend on it. This is the default value.
Examples
-- Create the def_test table and the def_view_test view for creating rules. openGauss=# CREATE TABLE def_test ( c1 int4 DEFAULT 5, c2 text DEFAULT 'initial_default' ); openGauss=# CREATE VIEW def_view_test AS SELECT * FROM def_test; -- Create the rule def_view_test_ins. openGauss=# CREATE RULE def_view_test_ins AS openGauss=# ON INSERT TO def_view_test openGauss=# DO INSTEAD INSERT INTO def_test SELECT new.*; -- Drop the rule def_view_test_ins. openGauss=# DROP RULE def_view_test_ins ON def_view_test; -- Drop the def_test table and the def_view_test view. openGauss=# DROP VIEW def_view_test; openGauss=# DROP TABLE def_test;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot