Hi Alberto!
I just upgrade from 2.3 to 2.4.2 last night. It looks like your query is
incorrect. It should be returning "quota_storage_size" and
"quota_message_count" but right now your query is returning
"userdb_quota_storage_size" and "userdb_quota_storage_size".
Try this instead:
userdb sql {
query = SELECT home, CONCAT(username, '@', domain) AS username,
crampassword AS password, uid, gid, CONCAT(COALESCE(quota, 0), 'B') AS
quota_storage_size, COALESCE(quotamsgs, 0) AS quota_message_count FROM
users WHERE username = '%{ user | username | lower }' AND domain = '%{
user | domain | lower }'
iterate_query = SELECT CONCAT(username,'@',domain) AS user FROM users
}
Adam L Miller
Arda Dynamics, LLC / Recoil Networks, LLC
[1][email protected] | [2][email protected]
------ Original Message ------
From "Alberto via dovecot" <[3][email protected]>
To [4][email protected]
Date 3/3/2026 2:43:45PM
Subject Getting quota limits from DB
Hi group:
I have a Docker Dovecot 2.4.2 installation with MySQL user management,
with this record:
SELECT * FROM users;
+----------------------------------------------------------------------------
| username | domain | password | home | uid | gid | active | quota |
quotamsgs | crampassword
+----------------------------------------------------------------------------
| alberto | bersol.info | {MD5-CRYPT}$1$Jm... | /var/mail/alberto | 1000
| 1000 | Y | 3221225472 | 149999 | {CRAM-MD5}fd246... |
+----------------------------------------------------------------------------
But I have a problem with user quota definitions...
If I run "doveadm" command, I get the user quota occupation, I have
"quota_clone" plugin working, but I don't get user quota limit, I don't
know why:
-----
# docker exec -it midovecot doveadm quota get -A
Username Quota name Type Value Limit %
[5][email protected] User quota STORAGE 1925805 3145728 61
[6][email protected] User quota MESSAGE 37608 100000 37
-----
That limit isn't the correct limit set in DB, but the one is put in the
config, and it must to be override in my userdb:Extra Fields.
-----
# # docker exec -it midovecot doveadm config
# 2.4.2 (0962ed2104): /etc/dovecot/dovecot.conf
...
userdb sql {
iterate_query = SELECT CONCAT(username,'@',domain) AS user FROM users
query = SELECT home,CONCAT(username,'@',domain) AS username,crampassword
AS password,uid AS userdb_uid,gid AS userdb_gid,CONCAT(quota,'B') AS
userdb_quota_storage_size,concat('*:messages=',quotamsgs) AS
userdb_quota_storage_size FROM users WHERE username = '%{ user |
username | lower }' AND domain = '%{ user | domain | lower }'
}
...
quota_storage_size = 3G
quota_message_count = 100000
...
-----
Do you have any idea of the problem?
Best Regards,
Alberto
_______________________________________________
dovecot mailing list -- [7][email protected]
To unsubscribe send an email to [8][email protected]
References
Visible links
1. mailto:[email protected]
2. mailto:[email protected]
3. mailto:[email protected]
4. mailto:[email protected]
5. mailto:[email protected]
6. mailto:[email protected]
7. mailto:[email protected]
8. mailto:[email protected]
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]