On Mon, 9 Jul 2007, Paul J Stevens wrote:

Michael Monnerie wrote:
On Montag, 9. Juli 2007 Aaron Stone wrote:
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.

OK, I understand now, thanks.

As there's a problem with Pauls Trigger too, would this rule be correct? CREATE RULE drop_messages_with_mailbox AS ON DELETE TO
dbmail_messages DO DELETE FROM dbmail_physmessage WHERE id =
OLD.physmessage_id AND id NOT IN (SELECT physmessage_id from dbmail_messages);

The PostgreSQL documentation says that rules can be optimized and thus much cheaper than triggers, so it could be good to use rules when possible. What do you think about that?

I wasn't aware of that. Your rule looks ok to me.

Be aware that PostgreSQL rules are done at PARSE time, not EXECUTION time
I.E. the SQL gets modified.

Sometimes the trigger is really what you want.

LER



--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 512-248-2683                 E-Mail: [EMAIL PROTECTED]
US Mail: 430 Valona Loop, Round Rock, TX 78681-3893
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to