Stefan Förster
2009-Aug-09 13:06 UTC
[Dovecot] Wiki entry for expire plugin, PostgreSQL trigger needs update
The wiki entry at http://wiki.dovecot.org/Plugins/Expire needs an update for Dovecot 1.2 and PostgreSQL: -- v1.2+: CREATE OR REPLACE FUNCTION merge_expires() RETURNS TRIGGER AS $$ BEGIN IF exists(SELECT 1 FROM expires WHERE username = NEW.username AND mailbox = NEW.mailbox) THEN UPDATE expires SET expire_stamp = NEW.expire_stamp WHERE username = NEW.username AND mailbox = NEW.mailbox; RETURN NULL; ELSE RETURN NEW; END IF; END; $$ LANGUAGE plpgsql; CREATE TRIGGER mergeexpires BEFORE INSERT ON expires FOR EACH ROW EXECUTE PROCEDURE merge_expires(); At least that's what I think after looking at the code: iter = dict_iterate_init(dict, DICT_EXPIRE_PREFIX, DICT_ITERATE_FLAG_RECURSE | DICT_ITERATE_FLAG_SORT_BY_VALUE); /* We'll get the oldest values (timestamps) first */ while (dict_iterate(iter, &key, &value) > 0) { /* key = DICT_EXPIRE_PREFIX<user>/<mailbox> */ userp = key + strlen(DICT_EXPIRE_PREFIX); [...] T_BEGIN { username = t_strdup_until(userp, p); If this code does somehow iterate usernames which are not present in the dict, I apologize. Cheers Stefan
Stefan Förster
2009-Aug-09 19:49 UTC
[Dovecot] Wiki entry for expire plugin, PostgreSQL trigger needs update
* Stefan F?rster <cite+dovecot-users at incertum.net>:> The wiki entry at http://wiki.dovecot.org/Plugins/Expire needs an > update for Dovecot 1.2 and PostgreSQL:NVM. Seems everyone can change wiki pages.
Seemingly Similar Threads
- BUG: panic when using fs:posix as dict for acl_shared_dict
- BUG: panic when using fs:posix as dict for acl_shared_dict
- BUG: panic when using fs:posix as dict for acl_shared_dict
- BUG: panic when using fs:posix as dict for acl_shared_dict
- Problems running Dovecot 1.2.17 on AIX