"anonymous"
> I have a bit of a stumper.
>
> I'm writing an IMAP server. The goal it to achieve IMAP scalability by
> allowing a user to set up a fleet of thin servers to speak IMAP and push
> the scaling problem to the SQL layer (where the problem has been largely
> solved). This means I want to write it with PostgreSQL, but I want it to
> wind up being portable to whatever big iron someone might want to use.
Sounds like you should hire an experienced Postgres DBA, unless this is an
Open Source project.
> The only trick left is to arrange for a message to be deleted when its
> last messagemap entry is deleted.
Write a trigger, in PL/pgSQL, which executes whenever a record is deleted from
messagemap. The trigger should check whether there are any mailboxes left
with that particular message; if not, delete it.
Triggers are covered in the online documentation.
--
-Josh Berkus
Aglio Database Solutions
San Francisco