Subject: triggers on views?

From: Robert Treat <[email-masked]>
Date: Mon, 14 Jul 2008 22:42:04 -0400

We had a doc comment come in noting that the second paragraph seems to be 
incorrect on 
http://www.postgresql.org/docs/8.3/interactive/rules-triggers.html, 
specifically the part that says "On the other hand, a trigger that is fired 
on INSERT on a view can do the same as a rule".  I'm not sure if this is 
supposed to just be taken as a conceptual argument, but it is confusing 
because you can't put insert triggers on views... so just what is it getting 
at? This exists in several versions back, not sure how folks feel about 
updating existing versions, but seems like it could use some rewording... 
thoughts? 

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

---

From: Tom Lane <[email-masked]>
Date: Tue, 15 Jul 2008 10:01:21 -0400

Robert Treat <[email-masked]> writes:
> on INSERT on a view can do the same as a rule".

This was discussed last month:
http://archives.postgresql.org/pgsql-general/2008-06/msg00669.php

			regards, tom lane

---

From: Bruce Momjian <[email-masked]>
Date: Mon, 15 Dec 2008 22:12:32 -0500 (EST)

> http://archives.postgresql.org/pgsql-general/2008-06/msg00669.php

OK, updated wording applied to CVS HEAD; attached.

-- 
  Bruce Momjian  <[email-masked]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/rules.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/rules.sgml,v
retrieving revision 1.51
diff -c -c -r1.51 rules.sgml
*** doc/src/sgml/rules.sgml	1 Feb 2007 19:10:24 -0000	1.51
--- doc/src/sgml/rules.sgml	16 Dec 2008 03:10:55 -0000
***************
*** 1869,1881 ****
  </para>
  
  <para>
!     On the other hand, a trigger that is fired on
!     <command>INSERT</command> on a view can do the same as a rule: put
!     the data somewhere else and suppress the insert in the view. But
!     it cannot do the same thing on <command>UPDATE</command> or
!     <command>DELETE</command>, because there is no real data in the
!     view relation that could be scanned, and thus the trigger would
!     never get called. Only a rule will help.
  </para>
  
  <para>
--- 1869,1877 ----
  </para>
  
  <para>
!     On the other hand, a trigger cannot be created on views because
!     there is no real data in a view relation;  however INSERT, UPDATE,
!     and DELETE rules can be created on views.
  </para>
  
  <para>