SQLite can't handle SET NAMES

Mark Martinec Mark.Martinec+amavis at ijs.si
Fri May 13 17:02:04 CEST 2011


Roland,

> After upgrading to 2.6.5 my mailserver stopped delivering mails.
> I extracted the following lines from my logfiles:
> Apr 20 17:25:07 devel amavis[11664]: (11664-01) (!!)TROUBLE in 
>   process_request: DBD::SQLite::db do failed: near "SET":
>   syntax error at (eval 102) line 245, <GEN17> line 5.
> Apr 20 17:25:07 devel amavis[11664]: (11664-01) (!)Requesting process 
> rundown after fatal error
> 
> I'm using SQLite for the policies and white-/ blacklisting.
> After commenting out line 19500: $dbh->do("SET NAMES 'utf8'");
> it works again.
> Looks like SQLite can't handle this setting and afaik it doesn't need it.

Thanks, I forgot there are SQL servers which cannot handle SET NAMES.
Will apply the following patch for 2.6.6 (backported from 2.7.0):

--- amavisd.orig	2011-04-07 20:21:49.000000000 +0200
+++ amavisd	2011-05-13 16:59:27.510170785 +0200
@@ -19498,5 +19498,10 @@
 # $dbh->{mysql_auto_reconnect} = 1;  # questionable benefit
 # $dbh->func(30000,'busy_timeout');  # milliseconds (SQLite)
-  $dbh->do("SET NAMES 'utf8'");
+  eval {
+    $dbh->do("SET NAMES 'utf8'"); 1;
+  } or do {
+    my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
+    do_log(2,"connect_to_sql: SET NAMES 'utf8' failed: %s", $eval_stat);
+  };
   section_time('sql-connect');
   $self;


Mark


More information about the amavis-users mailing list