This explains the problem very well! I would have struggled with this one because I have a hard time wrapping my head around the concept that the returned value of the passdb query will modify 'user' for the userdb query.
Just a side note, but I think it would be helpful to explicitly add the side effect to the documentation. The ability to verify the password in the case where there are multiple instances is very, very helpful, so other people may have the same trouble.
Thank you for the help!!
Terry
On 5/22/26 12:57 PM, Aki Tuomi wrote:
On 22/05/2026 19:37 EEST Terry Braun via dovecot <dovecot@dovecot.org> wrote:
I'm using this passdb sql to a postgres db
passdb sql { query = SELECT NULL AS password, 'Y' as nopassword, userid AS user
FROM users
WHERE addr = '%{user}' AND password = '%{password}' }Returning
fooas userid will, in your config, change user tofoo.Aki