Subject: create rule syntax

From: Kris Jurka <[email-masked]>
Date: Wed, 11 May 2005 14:23:00 -0500 (EST)

The manual shows slightly different variations for the create rule
syntax here and here:

http://www.postgresql.org/docs/8.0/static/rules-update.html
http://www.postgresql.org/docs/8.0/static/sql-createrule.html

The attached patches makes the first look like the second.  The key change 
is that it shows how multiple actions are delimited:

(actions) vs. (command ; command ...)

Kris Jurka
Index: doc/src/sgml/rules.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/rules.sgml,v
retrieving revision 1.41
diff -c -r1.41 rules.sgml
*** doc/src/sgml/rules.sgml	29 Jan 2005 23:45:36 -0000	1.41
--- doc/src/sgml/rules.sgml	11 May 2005 19:19:59 -0000
***************
*** 902,910 ****
      Keep the syntax
  
  <programlisting>
! CREATE RULE <replaceable>rule_name</> AS ON <replaceable>event</>
!     TO <replaceable>object</> [WHERE <replaceable>rule_qualification</>]
!     DO [ALSO|INSTEAD] [<replaceable>action</> | (<replaceable>actions</>) | NOTHING];
  </programlisting>
  
      in mind.
--- 902,910 ----
      Keep the syntax
  
  <programlisting>
! CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
!     TO <replaceable class="parameter">table</replaceable> [ WHERE <replaceable class="parameter">condition</replaceable> ]
!     DO [ ALSO | INSTEAD ] { NOTHING | <replaceable class="parameter">command</replaceable> | ( <replaceable class="parameter">command</replaceable> ; <replaceable class="parameter">command</replaceable> ... ) }
  </programlisting>
  
      in mind.

---

From: Neil Conway <[email-masked]>
Date: Fri, 20 May 2005 11:37:49 +1000

Kris Jurka wrote:
> The attached patches makes the first look like the second.

Applied, thanks.

-Neil

---

From: Robert Treat <[email-masked]>
Date: Fri, 20 May 2005 07:56:53 -0400

> > The attached patches makes the first look like the second.

Sorry I missed this before, but the first examples use of create rule on 
*object* rather than *table* seems like something important enough to keep, 
since obviously rules can be on more than just tables. 

-- 
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

---

From: Neil Conway <[email-masked]>
Date: Fri, 20 May 2005 22:31:10 +1000

> since obviously rules can be on more than just tables. 

I can't get too excited about this. CREATE RULE uses "table" as well, 
and specifies that "table" really means "table or view". Similarly, the 
INSERT syntax summary talks about "INSERT INTO table ...", although of 
course you can insert into a view if the appropriate rule exists. A view 
is a table in more ways than one...

-Neil