Quota SQL separate queries?

Akos Vandra axos88 at gmail.com
Mon Jun 22 08:12:32 UTC 2015


Hello,

We are trying to enforce per-domain quotas.
Currently my quota-sql.conf looks like this:

connect = host=/var/run/postgresql dbname=mail user=mailreader

map {
  pattern = priv/quota/storage
  table = quota
  username_field = username
  value_field = bytes
}
map {
  pattern = priv/quota/messages
  table = quota
  username_field = username
  value_field = messages
}

With

  quota = dict:Domain:%d:proxy::sqlquota


This works with a trigger by updating and , however I am unable to show the
administrators a list of which of their users are using the most space.
That is to be purely informative, and is not to be enforced.

I would appreciate if there was a documented way to specify exact SQL
queries to run for inserting, updating and selecting from the quota
storage, something like this:

-- CREATE VIEW quota_domain AS SELECT domain, sum(bytes), sum(messages)
FROM quotas GROUP BY domain


INSERT/UPDATE INTO quotas(username, domain, bytes, messages)
SELECT bytes, messages from quota_domain WHERE domain  = %d

Is there such a possibility?
If not, can you suggest a workaround to have a list of per-user quota
usages as well as enforced per-domain quotas?

Thanks,
  Akos Vandra


More information about the dovecot mailing list