pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jens Hartwig <jens.hartwig@t-systems.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: AW: Problems with RULE
Date: Wed, 07 Mar 2001 11:43:55 -0500
Message-ID: <9754.983983435@sss.pgh.pa.us> (raw)
In-Reply-To: <000d01c0a6d6$c9976bd0$c10ac98a@0000864A433A>
References: <000d01c0a6d6$c9976bd0$c10ac98a@0000864A433A>

"Jens Hartwig" <jens.hartwig@t-systems.de> 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



view thread (4+ messages)  latest in thread

Message-ID: <9754.983983435@sss.pgh.pa.us>
Permalink:  ../9754.983983435@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9754.983983435@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jens.hartwig@t-systems.de
  Subject: Re: Problems with RULE
  In-Reply-To: <9754.983983435@sss.pgh.pa.us>
  References: <000d01c0a6d6$c9976bd0$c10ac98a@0000864A433A> <9754.983983435@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox