Re: on duplicate key

From: "A B" <gentosaker(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: on duplicate key
Date: 2008-09-26 08:27:31
Message-ID: dbbf25900809260127xa11f254w6911c807b6934c87@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Reg Me Please 2008-09-26 08:31:07 Re: Dynamically created cursors vanish in PLPgSQL
Previous Message Joey K. 2008-09-26 06:46:00 ]OT] Database structure question