Re: AW: Problems with RULE - Mailing list pgsql-sql

From Tom Lane
Subject Re: AW: Problems with RULE
Date
Msg-id 9754.983983435@sss.pgh.pa.us
Whole thread Raw
In response to AW: Problems with RULE  ("Jens Hartwig" <jens.hartwig@t-systems.de>)
List pgsql-sql
"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


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: No Documentation for to_char(INTERVAL, mask)
Next
From: Tom Lane
Date:
Subject: Re: [DOCS] Extending PostgreSQL Using C