> > TROUBLE in check_mail: quar+notif FAILED: temporarily unable to
> > quarantine: 451 4.5.0 Storing to sql db as mail_id 2i86bAAnI5jq failed:
> > writing mail text to SQL failed:
> > Error closing, flush: sql inserting text failed, sql exec:
> > err=7, 22021, DBD::Pg::st execute failed:
> > ERROR: invalid byte sequence for encoding "UTF8": 0xbb at (eval 46)

> The mail_text is just a sequence of bytes and is not supposed to be
> interpreted as UTF-8 encoding. Looks like field quarantine.mail_text
> should be declared differently, and not as type 'text'. What would be
> an appropriate data type to store an arbitrary sequence of bytes
> without interpretation as characters?

Nikola Milutinovic writes:
| PgSQL has long had support for "bytea", which is an array of bytes. That is
| the preferred type for BLOBs. Also, there is a "Large Object" type, but that
| is older and requires non standard handling. It does have some performance
| advantage over bytea, though.   

Thanks Nikola!

I'm placing the following in 2.4.4 RELEASE_NOTES:

- PostgreSQL: updated documentation in README.sql to suggest using data
  type 'bytea' instead of inappropriate data type 'text' for a field
  quarantine.mail_text. To convert an existing table please use:
    ALTER TABLE quarantine ALTER mail_text TYPE bytea
      USING decode(replace(mail_text,'\\','\\\\'),'escape');
  Problem reported by Justin Hillyard, correct data type suggested by
  Nikola Milutinovic;


and the following in README.sql:

-- PostgreSQL notes:
...
-- - field quarantine.mail_text should be of data type 'bytea' and not 'text'
--   as suggested in older documentation; this is to prevent it from being
--   unjustifiably associated with some character set, and to be able to
--   store any byte value (including NUL); to convert existing field from
--   type 'text' into type 'bytea' the following clause may be used:
--       ALTER TABLE quarantine ALTER mail_text TYPE bytea
--         USING decode(replace(mail_text,'\\','\\\\'),'escape');

Btw, is the replace(mail_text,'\\','\\\\') really necessary (as documented
elsewhere)? Looks like a big fudge. Well, as long as it works...

  Mark


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to