>>>>> "Michael" == Michael Monnerie <michael.monne...@is.it-management.at> 
>>>>> writes:

Michael> I would have thought convert_from, possibly combined with
Michael> convert, would do it.  And this should really do the magic,
Michael> but I'm on 8.1 today, will test on 8.3 soon.

Indeed, convert_from() can be used to coerce the messageblk to text,
but only if dbmail knows how the blk is encoded.

This query in psql does give me the header of a message sent to this
group:

,----
| select physmessage_id from dbmail_messageblks where is_header = 1
|    and convert_from(messageblk,'SQL_ASCII') ~ 'dbmail-dev' limit 1;
`----

It is, however, as one might expect quite slow.

If one blindly uses 'SQL_ASCII', octets other than those from in /[\n\t -~]/
aka /\n\t\x20-\x7E/ seem to be output as C-style backslash escapes.
That may or may not be useful for imap search.

There is also the question of whether imap search is supposed to search
the over-the-wire format of the mail or the as-viewed-in-an-MUA format.
Ie, how imap search and mime are supposed to interact.

This query would get all of the mail which have 'dmail-dev' in their
bodies, ordered by physmessage_id.  But it is wildly disk intensive,
as psql has to read through every messageblk in dbmail_messageblks.

,----
| select convert_from(messageblk,'SQL_ASCII') from dbmail_messageblks
|    where physmessage_id in ( select physmessage_id
|       from dbmail_messageblks
|       where is_header=0 and
|       convert_from(messageblk,'SQL_ASCII') ~ 'dbmail-dev' )
|    order by physmessage_id, is_header desc;
`----

Generating an index of the output of convert_from(messageblk,'SQL_ASCII')
would be painful at best.

-JimC
-- 
James Cloos <cl...@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to