Re: atomic function

From: Mage <mage(at)mage(dot)hu>
To: Pgsql-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: atomic function
Date: 2005-08-16 09:27:45
Message-ID: 4301B191.80401@mage.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dennis Bjorklund wrote:

>On Mon, 15 Aug 2005, Mage wrote:
>
>
>
>>2005-08-12 19:08:43: ERROR: duplicate key violates unique constraint
>>"common_adviewnum_adid_site_day_index"
>>
>>
>
>Between your select and your insert someone else inserted a row making the
>insert fail.
>
>
I see. I thought that the function will be atomic but I was wrong.

>See this example of how you can update or insert depending on what is in
>the table:
>
>http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE
>
>
Or should I simply lock the table?

Mage

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Surabhi Ahuja 2005-08-16 10:36:57 regarding isolation amongst threads
Previous Message Magnus Hagander 2005-08-16 09:10:57 Re: ~/pgpass