From 8f60f43f2e23add472acd988741411e025bff87d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 2 Sep 2002 20:04:40 +0000 Subject: Department of second thoughts: make checks for replacing a view slightly more flexible, and improve the error reporting. Also, add documentation for REPLACE RULE/VIEW. --- doc/src/sgml/ref/create_rule.sgml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'doc/src/sgml/ref/create_rule.sgml') diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml index 86046359b4..998d075a64 100644 --- a/doc/src/sgml/ref/create_rule.sgml +++ b/doc/src/sgml/ref/create_rule.sgml @@ -1,5 +1,5 @@ @@ -21,17 +21,15 @@ PostgreSQL documentation 2001-01-05 -CREATE RULE name AS ON event +CREATE [ OR REPLACE ] RULE name AS ON event TO table [ WHERE condition ] DO [ INSTEAD ] action where action can be: NOTHING -| -query -| -( query ; query ... ) +| query +| ( query ; query ... ) @@ -76,9 +74,10 @@ NOTHING condition - Any SQL conditional expression (returning boolean). The condition expression may not + Any SQL conditional expression (returning boolean). + The condition expression may not refer to any tables except new and - old. + old, and may not contain aggregate functions. @@ -142,6 +141,14 @@ CREATE RULE Description + + CREATE RULE defines a new rule applying to a specified + table or view. + CREATE OR REPLACE RULE will either create a + new rule, or replace an existing rule of the same name for the same + table. + + The PostgreSQL rule system allows one to define an @@ -318,7 +325,7 @@ UPDATE mytable SET name = 'foo' WHERE id = 42; - CREATE RULE statement is a PostgreSQL + CREATE RULE is a PostgreSQL language extension. There is no CREATE RULE statement in SQL92. -- cgit v1.2.1