Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D209E65033F for ; Mon, 15 Dec 2008 23:12:44 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 17646-07 for ; Mon, 15 Dec 2008 23:12:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 4741D6502B5 for ; Mon, 15 Dec 2008 23:12:42 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id mBG3CWv09841; Mon, 15 Dec 2008 22:12:32 -0500 (EST) From: Bruce Momjian Message-Id: <200812160312.mBG3CWv09841@momjian.us> Subject: Re: triggers on views? In-Reply-To: <18407.1216130481@sss.pgh.pa.us> To: Tom Lane Date: Mon, 15 Dec 2008 22:12:32 -0500 (EST) CC: Robert Treat , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1229397152-20708-2_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/10 X-Sequence-Number: 5017 --ELM1229397152-20708-2_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Tom Lane wrote: > Robert Treat writes: > > 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". > > This was discussed last month: > http://archives.postgresql.org/pgsql-general/2008-06/msg00669.php OK, updated wording applied to CVS HEAD; attached. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. + --ELM1229397152-20708-2_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/diff2" 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 **** ! On the other hand, a trigger that is fired on ! INSERT 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 UPDATE or ! DELETE, 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. --- 1869,1877 ---- ! 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. --ELM1229397152-20708-2_--