21 Aug
2009
21 Aug
'09
5:02 p.m.
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.