there's no other way around it, in every programming language. You want to 
do something in a transaction, the db won't let you do it, you catch the 
exception (rollbacking) and deal with it.

On Wednesday, August 13, 2014 7:30:58 PM UTC+2, Jack Kuan wrote:
>
> How does one usually deal with such conflict? (two identical(except for 
> id's) inserts causing a violation of an unique constraint)
>
> Isolating the insert into its own transaction and then do a db.commit(), 
> catch any exception and then ignore?
>
> Thanks
>
> On Wednesday, August 13, 2014 10:57:13 AM UTC-4, Niphlod wrote:
>>
>> the problem in concurrency (andduplication) isn't the update part, it's 
>> the insert part....
>>
>> On Wednesday, August 13, 2014 1:39:56 PM UTC+2, Leonel Câmara wrote:
>>>
>>> Couldn't he use a _for_update argument there to make this work in some 
>>> adapters?
>>>
>>> db.mytable.update_or_insert(q, name='test', _for_update=True)
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to