Re: Multiple-action rule surprise - Mailing list pgsql-bugs

From Andrew - Supernews
Subject Re: Multiple-action rule surprise
Date
Msg-id slrndf58jf.bj3.andrew+nonews@trinity.supernews.net
Whole thread Raw
In response to Multiple-action rule surprise  ("Eugene Shekhtman" <postgre@xenomics.com>)
List pgsql-bugs
On 2005-08-04, "Eugene Shekhtman" <postgre@xenomics.com> wrote:
> PostgreSQL version: 8.0.3
> OS: Win32 (Win 2003 Server)
>
> There is something strange and counterintuitive about the way that
> multiple-action PostgreSQL rules work.

The absolute first thing you must learn about using rules in postgresql
is that _rules are not procedural logic_, i.e. you can't express them as
"if (a) then do B".  Rules rewrite the command _before_ anything is
executed (indeed before anything is even planned).  At the time of
rewriting, there is no way to know whether the WHERE clause of a rule will
be matched, so the rule is always expanded the same way, and the WHERE
clause becomes part of the rewritten command.

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

pgsql-bugs by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: Multiple-action rule surprise
Next
From: "Janet Hempstead"
Date:
Subject: BUG #1807: cannot build postgresql: libascii_and_mic.so.0.0: No such file or directory