last_login plugin with MySQL

Gedalya gedalya at gedalya.net
Sun Oct 19 08:29:51 UTC 2014


On 10/19/2014 04:10 AM, Michael Cramer wrote:
> Zitat von Luigi Rosa <lists at luigirosa.com>:
>
>> Gedalya wrote on 18/10/2014 17:36:
>>
>>> The code looks at shared/$last_login_key, so 
>>> shared/last-login/username,
>>> but your map says /shared/last-login/$user, note the leading slash! 
>>> That's
>>> probably all it is.
>>
>>
>> BINGO!
>>
>> Now that we killed the mosters of this level, let's move to the next 
>> level.....
>>
>>
>> Welcome to the SQL query level!
>>
>> I was expecting an UPDATE...WHERE but I got this:
>>
>> INSERT INTO mailbox (lastlogin,username) VALUES 
>> ('1413647370','username') ON
>> DUPLICATE KEY UPDATE lastlogin='1413647370'
>>
>> This is not very useful if I want a `lastlogin` field of the 
>> `mailbox` table
>> updated on every login.
>>
>>
>>
>>
>> Ciao,
>> luigi
>>
>> - -- 
>> /
>> +--[Luigi Rosa]--
>> \
>>
>> For every human problem, there is a neat, simple solution;
>> and it is always wrong.
>
> anybody knows how this can be achieved with postgresql, because 'ON 
> DUPLICATE KEY UPDATE' syntax is mysql specific
The user is not causing the 'ON DUPLICATE KEY UPDATE', that's the 
dovecot mysql driver.
Dict is an abstraction layer. It will just work if you do pretty much 
the same config but with the postgres driver.



More information about the dovecot mailing list