← Back to team overview

maria-discuss team mailing list archive

Re: Deadlock on update with same values.

 

Hello

For those with the same problem, I found a completely stupid solution, which 
works!

update user set lastlogin = IF(lastlogin != NOW(),NOW(),NOW()) where 
concat(userid,'@',domain)='$USER'

For those now knowing what IF does...

If lastlogin is not NOW() update it and set it to NOW() else set it to NOW()

Well actualy this does exactly the same as 
update user set lastlogin = NOW()
but surprisingly does not lead to the deadlock error, if lastlogin is already 
NOW().

Mit freundlichen Grüssen

Benoit Panizzon
-- 
I m p r o W a r e   A G    -    
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 07
CH-4133 Pratteln                Fax  +41 61 826 93 02
Schweiz                         Web  http://www.imp.ch
______________________________________________________


Follow ups

References