> Here is the appropriate documentation link, where they have an example:
> http://www.postgresql.org/docs/8.3/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
>
> The primary difference is that they use a loop, which is more robust. In
> theory, if you delete the record between when the INSERT happens and
> when the UPDATE happens, you will get no effect, which isn't what you're
> looking for. The loop will correct for this by ensuring that something
> happens before it terminates.
Yes, it could have been removed.
I seem to remember that it is not possible to lock the table with a
transaction from within a function, this has to be done on the level
from which I call the function?
> However, you can do the same thing on the command line using
> subtransactions, a.k.a. SAVEPOINTs:
> http://www.postgresql.org/docs/8.3/static/sql-savepoint.html
Oh, fun to learn new stuff :-)
Thank you for your reply