Re: AW: Problems with RULE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jens Hartwig" <jens(dot)hartwig(at)t-systems(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: AW: Problems with RULE
Date: 2001-03-07 16:43:55
Message-ID: 9754.983983435@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Jens Hartwig" <jens(dot)hartwig(at)t-systems(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Hannu Krosing 2001-03-07 16:48:49 Re: Extending PostgreSQL Using C
Previous Message Josh Berkus 2001-03-07 16:38:25 Re: No Documentation for to_char(INTERVAL, mask)