Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f27GiMx01090 for ; Wed, 7 Mar 2001 11:44:22 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f27Ght909757; Wed, 7 Mar 2001 11:43:55 -0500 (EST) To: "Jens Hartwig" cc: pgsql-sql@postgresql.org Subject: Re: AW: Problems with RULE In-reply-to: <000d01c0a6d6$c9976bd0$c10ac98a@0000864A433A> References: <000d01c0a6d6$c9976bd0$c10ac98a@0000864A433A> Comments: In-reply-to "Jens Hartwig" message dated "Wed, 07 Mar 2001 08:18:19 +0100" Date: Wed, 07 Mar 2001 11:43:55 -0500 Message-ID: <9754.983983435@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/146 X-Sequence-Number: 1798 "Jens Hartwig" writes: > What would have happened, if I executed an unconditional DELETE? > => DELETE FROM t_xyz; > Which statement would have been generated by PostgreSQL in this case? Unfortunately, I didn't keep the prior discussion, so I don't remember exactly what the rule was. But the general idea for conditional rules is that we generate rule-action WHERE rule-action's-own-conditions AND rule-condition AND conditions-from-original-query (repeat for each action of each relevant rule) and then if we didn't find any relevant unconditional INSTEAD rules, we generate original-query-action WHERE conditions-from-original-query AND NOT (conditions-of-conditional-INSTEAD-rules) There's a more extensive discussion in the Programmer's Guide, http://www.postgresql.org/devel-corner/docs/postgres/rules.html regards, tom lane