[Dovecot] expire plugin: columns not uniq

Nikita Koshikov koshikov at gmail.com
Fri Aug 21 17:02:58 EEST 2009


> Search the Wiki about Postgres and the requirement of a TRIGGER.
> I guess that sqlite requires something like this.

Maybe someone family with sqlite will say how to make this trigger better and constrain check field existence before doing UPDATE

CREATE TRIGGER mergeexpire BEFORE INSERT ON expires FOR EACH ROW
BEGIN 
	UPDATE expires SET expire_stamp=NEW.expire_stamp 
		WHERE username = NEW.username AND mailbox = NEW.mailbox; 
	SELECT raise(ignore) 
		WHERE (SELECT 1 FROM expires WHERE username = NEW.username AND mailbox = NEW.mailbox) IS NOT NULL;
END;

This seem some kind crudely to me, but it's working.


More information about the dovecot mailing list