Yesterday I took the plunge from nnmh to dbmail storage of my mail.

Rather than waiting until I managed to hack in variables support to
libsieve, I am piping to dbmail-smtp from my procmailrc, specifying
the folder with -M.

It is mostly going OK, but there are a couple of issues.

Gnus is not too happy with the non-contiguous UIDs.  I know that dbmail
is compliant with the IMAP RFCs here, but it is still a pain.

The conventional way to get a per-group incremental in postgres is
something like:

,----
| CREATE PROCEDURAL LANGUAGE plpgsql;
| 
| CREATE FUNCTION article_article_next(g integer) RETURNS integer
|     AS $$
| declare
| next_article int;
| begin
| select into next_article article_counter from groups where id=g;
| update groups set article_counter = article_counter + 1 where id=g;
| return next_art;
| end;
| $$
|     LANGUAGE plpgsql;
| 
| CREATE FUNCTION set_article() RETURNS "trigger"
|     AS $$
| begin
| new.article = article_article_next(new.grp);
| return new;
| end
| $$
|     LANGUAGE plpgsql;
| 
| CREATE TABLE groups (
|     id serial NOT NULL,
|     article_counter integer DEFAULT 0 NOT NULL,
|     name text NOT NULL,
| );
| 
| CREATE TABLE articles (
|     grp integer NOT NULL,
|     article integer NOT NULL,
| );
|
| CREATE TRIGGER article_article_trigger BEFORE INSERT ON articles
|     FOR EACH ROW EXECUTE PROCEDURE set_article();
`----

That of course will need revision for dbmail, but illustrates the basic
concept.

I don't know the equivalent for mysql or sqlite, but I understand mysql
supports something similar.

Is there any chance of getting something like this into dbmail?

If so I'll spend some time cleaning it up.

It will of course require a transition schema to add the column to
dbmail_mailboxes and set it to nextval('dbmail_message_idnr_seq')
(to keep the UIDNEXT values seen by any clients valid).  Then it'll
have to add a mailbox_uid column to dbmail_messages and populate that,
for current messages, with each message's message_idnr.

A unique contraint should probably also be added on (mailbox_idnr,
message_uid).

Or the primary key for mailboxes could be changes from message_idnr to
(message_idnr, mailbox_idnr).  That, with the trigger instead of the
default should allow the current C code to remain as is, yes?

Again, any chance such changes will be accepted?

-JimC
-- 
James Cloos <[EMAIL PROTECTED]>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to