Re: what are rules for?

From: "Michael Shulman" <shulman(at)mathcamp(dot)org>
To: "Dean Rasheed" <dean_rasheed(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, kleptog(at)svana(dot)org, adam(dot)r(at)sbcglobal(dot)net
Subject: Re: what are rules for?
Date: 2008-06-26 17:47:04
Message-ID: c3f821000806261047x19173565ne37ee15618c289a4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 26, 2008 at 12:11 PM, Dean Rasheed <dean_rasheed(at)hotmail(dot)com> wrote:
> This can almost be implemented in PostgreSQL right now, using a rule of
> the form "... do instead select trigger_fn()" - except, as you point out, the
> caller won't know how many rows were actually updated. As far as the
> top-level query knows, it didn't update anything, which will break some
> (most?) clients. Apart from that, this does actually work!

Yeah, I actually thought of that. But as you point out, many clients
would get confused. Someone pointed out in an earlier thread that a
way to fix this, for updates on a multi-table view (where most of the
complication lies), is to write a "trigger" function that updates all
the constituent tables except for one, and then write a rule that
calls that function and then updates the one remaining table itself.
This seems to work okay although I have not tested it with many
clients.

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ryan VanMiddlesworth 2008-06-26 17:54:44 Query with varchar not using functional index
Previous Message Brandon Metcalf 2008-06-26 17:24:51 Re: new RETURNING clause and Pg.pm