Re: RULE vs TRIGGER - Mailing list pgsql-general

From will trillich
Subject Re: RULE vs TRIGGER
Date
Msg-id 20010731183115.D27771@serensoft.com
Whole thread Raw
In response to Re: RULE vs TRIGGER  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
On Tue, Jul 31, 2001 at 11:05:37AM -0700, Stephan Szabo wrote:
> I meant using a lock table statement explicitly at the
> beginning of the trigger (LOCK TABLE tbl; -- possibly
> would have to be through execute, I'm not sure) which
> I would presume would mean that the "second" would
> have to wait at that point until the first transaction
> finished completely.  Of course this cuts down your
> concurrency as only one transaction calling this would
> be able to run and the rest would have to wait.

hmm. so, how about

    create rule
        add_new_item as
        on insert to fake_view
        do instead (
            begin work;
            lock table _real_data;
            insert into _real_data ( ... ) values ( ... );
            commit work;
        );

would something like this be legal...? (i.e. what's the syntax
necessary to make it happen behind-the-scenes?)

--
Khan said that revenge is a dish best served cold. I think
sometimes it's best served hot, chunky, and foaming.
    - P.J.Lee ('79-'80)

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: Nicholas Piper
Date:
Subject: Re: Really slow UPDATE and DELETE
Next
From: brichardson@lineone.net (Bruce Richardson)
Date:
Subject: Re: Sequences and inheritance