Re: on duplicate key - Mailing list pgsql-general

From A B
Subject Re: on duplicate key
Date
Msg-id dbbf25900809260127xa11f254w6911c807b6934c87@mail.gmail.com
Whole thread Raw
In response to Re: on duplicate key  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-general
> 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

pgsql-general by date:

Previous
From: "Joey K."
Date:
Subject: ]OT] Database structure question
Next
From: Reg Me Please
Date:
Subject: Re: Dynamically created cursors vanish in PLPgSQL