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 deleted.
- table_name
Name of the table to which the rule applies.
- CASCADE
Automatically cascade deletes 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. 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; -- Create the 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.*; -- Drop the rule def_view_test_ins. gaussdb=# DROP RULE def_view_test_ins ON def_view_test; -- Drop the def_test table and the def_view_test view. gaussdb=# DROP VIEW def_view_test; gaussdb=# 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.