[Dovecot] expire plugin: columns not uniq

Timo Sirainen tss at iki.fi
Mon Aug 24 20:27:37 EEST 2009


On Fri, 2009-08-21 at 17:02 +0300, Nikita Koshikov wrote:
> > 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.

That looks correct to me. I'll add it to the wiki page. A similar
trigger could be used for dict quota too. So now that SQLite is working,
I'll just start deprecating Berkeley DB support even more strongly.
Thanks. :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20090824/da50e902/attachment.bin 


More information about the dovecot mailing list