"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