OT: How to read PgSQL quarantined data

Mark Martinec Mark.Martinec+amavis at ijs.si
Fri Jul 29 14:47:38 CEST 2011


Christian,

> I use Postgres as SQL server for quarantined messages in amavis 2.7.0. I
> have round abozt 3.600 mails now inside the quarantine and I wanted to
> view some of them.
> 
> If using pgsql and do a simple
>   SELECT * FROM public.quarantine
> , all content is displayed in binarya (Hex?) format.

Yes, that is how PostgreSQL 9 represents bytea data.

> PgAdmin III also does not "convert" data.
> 
> So can somebody help me with pgsql and tell me, if I can make the data
> visible?

Mail text does not have any inherent character set, it is just a
bunch of octets. Decoding into character sets is done for each
mail MIME part according to its MIME Content-Type.

If you'd just like a quick glimpse of  mostly readable text,
you may encode these octets in escape notation, or force
them to be interpreted as Latin1 (even though they are not
necessarily such).

Something like:

select encode(mail_text,'escape') from quarantine
  where partition_tag=30 and mail_id='qAlfKSwhxCsk'
  order by chunk_ind asc;


Mark


More information about the amavis-users mailing list