Re: [AMaViS-user] amavisd 2.6.1/pgsql 8.3: Invalid byte sequence for utf8 encoding

2008-10-04 Thread Stefan Förster

Am 29.09.2008 um 16:51 schrieb Stefan Förster:

> Hello world,
>
> using DBD:Pg 1.49-2, pgsql 8.3.3 and amavisd-2.6.1, I get the
> following error:
>
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) DO_QUARANTINE, sender:
> <[EMAIL PROTECTED]>
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) SEND via SQL
> (DBI:Pg:database=mailsystem;host=127.0.0.1;port=5432):
> <[EMAIL PROTECTED]> -> <[EMAIL PROTECTED]>, mail_id
> KeeB0+GVNAU6
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql begin transaction
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) write_header: 0,
> Amavis::IO::SQL=HASH(0x5058c10)
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql print: key:
> (KeeB0+GVNAU6, 1), size=16384
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql: preparing and
> executing: INSERT INTO quarantine (mail_id, chunk_ind, mail_text)
> VALUES (encode(?,'escape'),?,encode(?,'escape'))
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql flush: key:
> (KeeB0+GVNAU6, 1), rx_time=1222698579, size=16384
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql: executing clause:
> INSERT INTO quarantine (mail_id, chunk_ind, mail_text) VALUES
> (encode(?,'escape'),?,encode(?,'escape'))
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) writing mail text to
> SQL failed: Error closing, flush: sql inserting text failed, sql exec:
> err=7, 25P02, DBD::Pg::st execute failed: ERROR:  current transaction
> is aborted, comma
> nds ignored until end of transaction block at (eval 44) line 177,
>  line 500. at (eval 44) line 68,  line 500.
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql rollback
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) mail_via_sql: rollback
> done
>
> Having a look at the pgsql log, I see that in fact the error causing
> said transaction to fail is:
>
> 2008-09-29 15:11:14 CEST ERROR:  invalid byte sequence for encoding
> "UTF8": 0xe46c74
> 2008-09-29 15:11:14 CEST HINT:  This error can also happen if the byte
> sequence does not match the encoding expected by the server, which is
> controlled by "client_encoding".
> 2008-09-29 15:11:14 CEST STATEMENT:  INSERT INTO quarantine (mail_id,
> chunk_ind, mail_text) VALUES ($1,$2,$3)
>
> I have tested both ways, defining quarantine.mail_test as bytea and as
> text (latter version with added "encode" statements in
> $sql_clause{'ins_quar'}.
>
> Any ideas on how to debug this further - or fix it?

I am _SO_ embarassed. Actually, this was an amavisd 2.4.2.


Sorry for the noise
Stefan
-- 
Stefan Förster http://www.incertum.net/ Public Key: 0xBBE2A9E9
"Wenn es sich um Geld handelt, gehört jeder der gleichen Religion an."
-- Voltaire


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 


Re: [AMaViS-user] amavisd 2.6.1/pgsql 8.3: Invalid byte sequence for utf8 encoding

2008-09-29 Thread Mark Martinec
Stefan,

> using DBD:Pg 1.49-2, pgsql 8.3.3 and amavisd-2.6.1, I get the
> following error:
> Sep 29 16:29:40 nemea amavis[8255]: (08255-01) writing mail text to
> SQL failed: Error closing, flush: sql inserting text failed, sql exec:
> err=7, 25P02, DBD::Pg::st execute failed: ERROR:  current transaction
> is aborted, commands ignored until end of transaction block at
> (eval 44) line 177,  line 500. at (eval 44) line 68,
>  line 500. 


> Having a look at the pgsql log, I see that in fact the error causing
> said transaction to fail is:
>
> 2008-09-29 15:11:14 CEST ERROR:  invalid byte sequence for encoding
> "UTF8": 0xe46c74
> 2008-09-29 15:11:14 CEST STATEMENT:  INSERT INTO quarantine (mail_id,
> chunk_ind, mail_text) VALUES ($1,$2,$3)
>
> I have tested both ways, defining quarantine.mail_test as bytea and as
> text (latter version with added "encode" statements in
> $sql_clause{'ins_quar'}.

Please see RELEASE_NOTES (2.6.0), text starting at:

- when SQL logging (pen pals) or SQL lookups are used, one can choose a
  binary or a character data type for fields users.email, mailaddr.email,
  and maddr.email; [...]

I hope it explains the situation and the solution.
The "encode"+bytea does not solve the situation, the SQL client
(i.e. amavisd) needs to specify a data type of the argument in
a call to sql.

  Mark

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 


[AMaViS-user] amavisd 2.6.1/pgsql 8.3: Invalid byte sequence for utf8 encoding

2008-09-29 Thread Stefan Förster
Hello world,

using DBD:Pg 1.49-2, pgsql 8.3.3 and amavisd-2.6.1, I get the
following error:

Sep 29 16:29:40 nemea amavis[8255]: (08255-01) DO_QUARANTINE, sender:
<[EMAIL PROTECTED]>
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) SEND via SQL
(DBI:Pg:database=mailsystem;host=127.0.0.1;port=5432):
<[EMAIL PROTECTED]> -> <[EMAIL PROTECTED]>, mail_id
KeeB0+GVNAU6
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql begin transaction
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) write_header: 0,
Amavis::IO::SQL=HASH(0x5058c10)
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql print: key:
(KeeB0+GVNAU6, 1), size=16384
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql: preparing and
executing: INSERT INTO quarantine (mail_id, chunk_ind, mail_text)
VALUES (encode(?,'escape'),?,encode(?,'escape'))
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql flush: key:
(KeeB0+GVNAU6, 1), rx_time=1222698579, size=16384
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql: executing clause:
INSERT INTO quarantine (mail_id, chunk_ind, mail_text) VALUES
(encode(?,'escape'),?,encode(?,'escape'))
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) writing mail text to
SQL failed: Error closing, flush: sql inserting text failed, sql exec:
err=7, 25P02, DBD::Pg::st execute failed: ERROR:  current transaction
is aborted, comma
nds ignored until end of transaction block at (eval 44) line 177,
 line 500. at (eval 44) line 68,  line 500.
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) sql rollback
Sep 29 16:29:40 nemea amavis[8255]: (08255-01) mail_via_sql: rollback
done

Having a look at the pgsql log, I see that in fact the error causing
said transaction to fail is:

2008-09-29 15:11:14 CEST ERROR:  invalid byte sequence for encoding
"UTF8": 0xe46c74
2008-09-29 15:11:14 CEST HINT:  This error can also happen if the byte
sequence does not match the encoding expected by the server, which is
controlled by "client_encoding".
2008-09-29 15:11:14 CEST STATEMENT:  INSERT INTO quarantine (mail_id,
chunk_ind, mail_text) VALUES ($1,$2,$3)

I have tested both ways, defining quarantine.mail_test as bytea and as
text (latter version with added "encode" statements in
$sql_clause{'ins_quar'}.

Any ideas on how to debug this further - or fix it?


Ciao
Stefan
-- 
Stefan Förster http://www.incertum.net/ Public Key: 0xBBE2A9E9
Niemand hat Angst vor mir, nur ich.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/