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}'
}
This succeed and the addr passed in as user is foo@example.com as expected
I use this userdb sql
userdb sql {
query = SELECT home, uid, gid
FROM users
WHERE addr = '%{user}'
# For using doveadm -A:
# iterate_query = SELECT userid AS username, domain FROM users
}
This fails because postgres receivesĀ just "foo" not "foo@example.com" as user.
maybe there is a bug in my stuff but I cannot see it. I can see the query in the postgres log where it clearly says:
WHERE addr = 'foo'
It also logs the passdb query:
WHERE addr = 'foo@example.com' ANDĀ password='secret'
thanks
Terry
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 foo as userid will, in your config, change user to foo.
Aki
participants (2)
-
Aki Tuomi
-
Terry Braun