Thanks Laurenz, very good point!
Luckily (phew!) the business scenario is such that race conditions cannot occur (and the transaction table is append only). There is business workflow to address duplicates but
1) it occurs extremely rarely (it would be a deliberate sabotage if it occurs)
2) there is no impact on business
Yours
Anil
Anil
On Fri, Nov 21, 2014 at 5:16 PM, Albe Laurenz <laurenz.albe@xxxxxxxxxx> wrote:
Anil Menon wrote:
> I would like to ask from your experience which would be the best "generic" method for checking if row
> sets of a certain condition exists in a PLPGSQL function.
>
> I know of 4 methods so far (please feel free to add if I missed out any others)
[...]
Are you aware that all of these methods have a race condition unless
you use isolation level READ STABILITY or better?
It may be that rows are added or removed between the check and the
corresponding action.
Yours,
Laurenz Albe