Search Postgresql Archives

Re: isn't "insert into where not exists" atomic?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/03/2011 10:35 PM, pasman pasmaÅski wrote:
Your trigger is wrong. You try to insert the same row twice.

I assume you didn't try it. If active_at field is null then the trigger does another insert instead of the original one. This avoids looping or inserting twice.

The only mistake is that I tought the insert with select will be atomic and I was wrong. So the trigger has concurrency problem in multi-threaded environment. It runs flawlessly in single thread and it does only a single insert.

        Mage


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux