<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=323253709-27052003>Ok: a 
little lame to answer my own question, but I created a CRUDE 
patch.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=323253709-27052003>It 
does NOT check why a connection failed, it just does a PQreset, and it SEEMS to 
work.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=323253709-27052003>Kind 
regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=323253709-27052003>Maikel 
Verheijen.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=323253709-27052003>Ps: 
Timo, can something with reconnect be implemented 
permanently?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=323253709-27052003>--8<--</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>--- src/auth/db-pgsql.c.ORIG    Tue 
May 27 10:06:39 2003<BR>+++ src/auth/db-pgsql.c Tue May 27 11:16:38 2003<BR>@@ 
-53,9 +53,16 @@<BR>        res = 
PQexec(conn->pg, 
query);<BR> <BR>        if 
(PQresultStatus(res) != PGRES_TUPLES_OK) 
{<BR>-               
i_error("PGSQL: Query \"%s\" failed: 
%s",<BR>-                       
query, 
PQresultErrorMessage(res));<BR>-               
failed = 
TRUE;<BR>+               
PQreset(conn->pg);<BR>+               
res = PQexec(conn->pg, 
query);<BR>+               
if (PQresultStatus(res) != PGRES_TUPLES_OK) 
{<BR>+                       
i_error("PGSQL: Query \"%s\" failed: 
%s",<BR>+                               
query, 
PQresultErrorMessage(res));<BR>+                       
failed = 
TRUE;<BR>+               
} else 
{<BR>+                       
i_error("PGSQL: Reconnected because of 
failure!");<BR>+                       
failed = 
FALSE;<BR>+               
}<BR>        } else 
{<BR>                
failed = FALSE;<BR>        }</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=323253709-27052003><FONT face=Arial color=#0000ff 
size=2>--8<--</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Maikel Verheijen 
  [mailto:maikel@ladot.com] <BR><B>Sent:</B> Tuesday, May 27, 2003 9:43 
  AM<BR><B>To:</B> 'Dovecot (E-mail)'<BR><B>Subject:</B> [Dovecot] Postgres 
  "issue"<BR><BR></FONT></DIV>
  <P><FONT size=2>Dear list,</FONT> </P><BR>
  <P><FONT size=2>I have a small issue with dovecot talking to a postgresql 
  server:</FONT> </P>
  <P><FONT size=2>If my postgres server get restarted, dovecot fails to 
  reconnect to the postgres server.</FONT> </P>
  <P><FONT size=2>I run dovecot 0.99.9.1 (which is actually a cvs version of 
  dovecot, of may 9 2003)</FONT> </P>
  <P><FONT size=2>I have the same postgres version for the server as I use for 
  the libraries.</FONT> </P>
  <P><FONT size=2>Is it hard to get auto-reconnect to work?</FONT> </P><BR>
  <P><FONT size=2>Kind regards,</FONT> </P><BR>
  <P><FONT size=2>Maikel Verheijen</FONT> </P><BR>
  <P><FONT size=2>Ps: the log message I get is this:</FONT> </P>
  <P><FONT size=2>May 22 17:33:01 testlfw3 dovecot-auth: PGSQL: Query "SELECT 
  password FROM aliases WHERE alias = 'maikel@test.com' AND password != ''" 
  failed: FATAL 1:  This connection has been terminated by the 
  administrator. server closed the connection unexpectedly ^IThis probably means 
  the server terminated abnormally ^Ibefore or while processing the request. 
  </FONT></P>
  <P><FONT size=2>Which probably describes it all :)</FONT> 
</P></BLOCKQUOTE></BODY></HTML>