On Fri, 2011-06-03 at 15:17 +0200, Marcin Mirosław wrote: > W dniu 03.06.2011 13:51, Timo Sirainen pisze: > Helo Timo! > > 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. > Yes...:) > I don't know internals in dovecot, mayby it will be nonsensical what > i'll say. Could it be better to set NULL instead delete of row?
The problem is that updates don't work then: mails=> insert into foo values (null); mails=> update foo set bar=bar+1; UPDATE 1 mails=> select * from foo; bar ----- (1 row) The whole problem is how to atomically increase/decrease a value in SQL, when the row may or may not exist. Of course it could be assumed that the row always exists and this would become a lot simpler. Hmm. That would basically require a whole new dict backend that used different SQL queries. > Or let user can define own queries e.g.: > DICT_QUOTA_DEL= ... > DICT_QUOTA_INSERT= > DICT_QUOTA_OTHER_ACTIONS= It's not that simple.