[Dovecot] Custom sql query for keeping quota with dict-sql

Timo Sirainen tss at iki.fi
Fri Jun 3 14:51:22 EEST 2011


On Thu, 2011-06-02 at 16:48 +0200, Marcin Mirosław wrote:

> i'd like to keep present quota in such two columns:
> quota_dict_bytes integer NOT NULL DEFAULT 0,
> quota_dict_messages integer NOT NULL DEFAULT 0
> 
> I read wiki a little and it looks i can't define own sql queries, they
> appear to be hardcoded. Am i wrong? Is it possible to write own queries
> to get/set quota using such table schema? Or maybe there is diffrent way
> to track quota for diffrent storages?

You can't define your own SQL queries for dict quota. Besides being able
to do such query, there's the problem that when recalculating quota it's
done by deleting a row and inserting it back. You wouldn't want to do
that for your users table. Making this work some other way could be
tricky with PostgreSQL. It's quite an ugly trigger already, because
there's no easy "ON DUPLICATE KEY UPDATE .." feature in PostgreSQL as
there is for MySQL.




More information about the dovecot mailing list