From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Help with trigger |
Date: | 2004-10-08 14:02:06 |
Message-ID: | 20041008140206.GA60144@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Fri, Oct 08, 2004 at 12:52:52AM -0600, Michael Fuhr wrote:
> The trigger function below, fired after inserts and updates, might
> be close to what you need. However, it doesn't enforce the 2-tuple
> limit -- it only contains the logic to delete records based on the
> criteria you specified. It worked in the minimal tests I performed,
> but I'd recommend doing more thorough testing before using it in
> production.
I should also point out that the trigger function I posted doesn't
deal with concurrency. For example, if an update happens in one
transaction, and an insert happens in another transaction before
the update commits, then you could end up with two records that
should have been deleted but weren't. The function I posted was
merely to show how one might perform the tests you need to make.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | Keith Worthington | 2004-10-08 18:49:12 | how to stop postmaster |
Previous Message | Michael Fuhr | 2004-10-08 06:52:52 | Re: Help with trigger |