Re: Multiple-action rule surprise

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Multiple-action rule surprise
Date: 2005-08-04 23:19:11
Message-ID: slrndf58jf.bj3.andrew+nonews@trinity.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2005-08-04, "Eugene Shekhtman" <postgre(at)xenomics(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-08-05 05:15:29 Re: BUG #1807: cannot build postgresql: libascii_and_mic.so.0.0: No such file or directory
Previous Message Jaime Casanova 2005-08-04 19:35:12 Re: Multiple-action rule surprise