X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 64964D1EB3E for ; Wed, 3 Mar 2004 21:24:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 87200-09 for ; Wed, 3 Mar 2004 17:24:38 -0400 (AST) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 4F3C6D1EABC for ; Wed, 3 Mar 2004 17:24:31 -0400 (AST) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by www.postgresql.com (Postfix) with ESMTP id 66E86CF4D2D for ; Wed, 3 Mar 2004 17:24:29 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i23J3Fx14760; Wed, 3 Mar 2004 14:03:15 -0500 (EST) From: Bruce Momjian Message-Id: <200403031903.i23J3Fx14760@candle.pha.pa.us> Subject: Re: "ALSO" keyword to "CREATE RULE" patch In-Reply-To: To: Fabien COELHO Date: Wed, 3 Mar 2004 14:03:15 -0500 (EST) Cc: PostgreSQL Patches X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/26 X-Sequence-Number: 9957 Is ALSO part of the SQL standard? I can't imagine it is because there is no rule mention. I guess if were were coding from scratch, we could make the syntax INSTEAD or ALSO, but at this point, I don't see adding ALSO as a useful change. --------------------------------------------------------------------------- Fabien COELHO wrote: > > Dear patchers, > > Please find attached a small patch to add an optionnal "ALSO" keyword > to the "CREATE RULE" syntax. > > The "ALSO" keyword can be used where "INSTEAD" would be used, > to mean the opposite, i.e. the current default behavior of rules > which adds operations to the current one. IMHO, it makes the > intended behavior much clearer for the basic user (say, me;-). > > CREATE RULE some_table_del AS > ON DELETE TO some_table DO ALSO > ( > DELETE FROM this_other_table WHERE id=old.id; > ); > > Of course, the absence of the "ALSO" keyword preserves the previous > behavior... that is it behaves the same as with the "ALSO" keyword. > > This patch was made against 7.4.1 with the "difforig" script > provided by postgresql. > > It adds "ALSO" keyword in the parser code (two lines), fixes somehow the > documentation and sql help, and modifies four of the "RULE" > test cases to use this keyword instead of the default nothing-ness. > > It validated for me with a "make check". > > Have a nice day, > > -- > Fabien Coelho - coelho@cri.ensmp.fr Content-Description: [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073