Until we have time to work on this and test it for real, it is better to simply
call:
DELETE FROM dbmail_physmessage WHERE id NOT IN
(SELECT physmessage_id FROM dbmail_messages);
every day or so.
Aaron Stone wrote:
On Sun, 2007-07-08 at 23:48 +0200, Michael Monnerie wrote:
On Samstag, 7. Juli 2007 Paul Stevens wrote:
That's why I looked into triggers, and found postgreSQL to have
rules: CREATE RULE drop_messages_with_mailbox AS ON DELETE TO
dbmail_messages DO DELETE FROM dbmail_physmessage WHERE id =
OLD.physmessage_id;
Evil dude. That's a simple foreign key constraint masking as a rule.
Nobody should use that rule: I found that rule to have the effect of
deleting all new arriving e-mail - it just vanishes, although I am not
sure why. It arrives via LMTP, and is not in your mailbox. But that
rule should only fire on DELETE, so there must be a delete somewhere in
the path when a new message is inserted, or postgres has a bug, or
whatever.
The message is first inserted for the internal delivery user, then a
copy of the messages table entry is made for each recipient (it is this
way that we have some primitive one-physmessage-many-messages support).
When delivery is done, the message is removed from the internal delivery
user's mailbox. That's what activates your rule.
Aaron
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail
--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail