From: | "MaFa" <mafalista(at)freemail(dot)hu> |
---|---|
To: | "pgsql-novice(at)postgresql(dot)" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Transaction in plpgsql function? |
Date: | 2003-11-23 18:21:48 |
Message-ID: | 015801c3b1ee$a8d77090$5ad206c1@attila |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
> You don't. All of a function takes place inside a transaction. If
> there is no explicit transaction already, an implicit one will have been
> started.
If it is true, then the following function why causes sometimes a "duplicate
row"' error?
begin
if exists(select session_data from session where session_id= $1 ) then
update session set session_data= $2, session_exp=now() + interval ''10
minutes'' where session_id= $1 ;
return 0;
else
insert into session(session_id, session_exp, session_data) values ($1 ,
now() + interval ''10 minutes'' , $2);
return 1;
end if;
end;
Maybe because of the current isolation level?
Thanks: MaFa
From | Date | Subject | |
---|---|---|---|
Next Message | Brian G. Huber | 2003-11-23 20:11:11 | Re: Installation of plpgsql using createlang comand |
Previous Message | Oliver Elphick | 2003-11-23 16:47:09 | Re: Transaction in plpgsql function? |