Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Ottavio Campana wrote: > Anyway, apart from a couple of errors in the code i wrote (an in isn't > closed and exception handling is not correctly written), can I be sure > that the code in the sub-block works an a snapshot of the db? It seems not to work, I put it into my application and I got Err

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Merlin Moncure wrote: > On 3/23/07, Ottavio Campana <[EMAIL PROTECTED]> wrote: >> Ottavio Campana wrote: >> > What would you to in order to be sure that one function or a part of it >> > is atomically executed? >> >> would it be correct something like? or how would you write this? >> >> create or r

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Merlin Moncure
On 3/23/07, Ottavio Campana <[EMAIL PROTECTED]> wrote: Ottavio Campana wrote: > What would you to in order to be sure that one function or a part of it > is atomically executed? would it be correct something like? or how would you write this? create or replace function my_function () returs int

Re: [GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Ottavio Campana wrote: > What would you to in order to be sure that one function or a part of it > is atomically executed? would it be correct something like? or how would you write this? create or replace function my_function () returs integer as $$ declare ... status boolean; ... begin

[GENERAL] concurrency in stored procedures

2007-03-23 Thread Ottavio Campana
Hi, using constraints on tables I was able to remove some race conditions, because the unique index prevents the same data to be inserted twice into the table. But I still didn't fix all the race conditions, because in some functions I have to modify more than one table or I just have read and wr