Received: from ns.krot.org (ns.krot.org [193.212.103.165]) by postgresql.org (8.11.3/8.11.4) with SMTP id f9MHO0P44256 for ; Mon, 22 Oct 2001 13:24:01 -0400 (EDT) (envelope-from postgresql@envisity.com) Received: (qmail 19721 invoked by uid 67); 21 Oct 2001 22:26:03 -0000 Message-ID: <20011021222603.10841.qmail@ns.krot.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline MIME-Version: 1.0 From: "Aasmund Midttun Godal" To: tgl@sss.pgh.pa.us Cc: pgsql-hackers@postgresql.org, joel@joelburton.com, pgsql-sql@postgresql.org Subject: Re: CREATE RULE ON UPDATE/DELETE Date: Sun, 21 Oct 2001 22:26:03 GMT X-Mailer: Googley-Moogley In-Reply-To: <28356.1003682861@sss.pgh.pa.us> from Tom Lane on Sun, 21 Oct 2001 12:47:41 -0400 References: <28356.1003682861@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id f9MIowN67233 X-Archive-Number: 200110/295 X-Sequence-Number: 5248 Yes, I agree perfectly... I never thought of that! I would really like it if some more info was added to the docs regarding info on rules and triggers. The section on update rules is quite good, but some more would never hurt. One point in the trigger vs rules section which at least to me is very important is the simple fact that you cannot have a trigger on a select... Ok I understand why - but it took some time... Thank you for answering my questions! regards, Aasmund. On Sun, 21 Oct 2001 12:47:41 -0400, Tom Lane wrote: > Joel Burton writes: > > > Surely you'd need something like > > CREATE RULE dbl_update AS ON UPDATE TO dbl DO INSTEAD UPDATE raw SET > id = NEW.id / 2, name = NEW.name WHERE OLD.id = id * 2; > > (untested...) > > regards, tom lane Aasmund Midttun Godal aasmund@godal.com - http://www.godal.com/ +47 40 45 20 46