RE: [Dovecot] Postgres "issue"
Ok: a little lame to answer my own question, but I created a CRUDE patch. It does NOT check why a connection failed, it just does a PQreset, and it SEEMS to work. Kind regards, Maikel Verheijen. Ps: Timo, can something with reconnect be implemented permanently? --8<-- --- src/auth/db-pgsql.c.ORIG Tue May 27 10:06:39 2003 +++ src/auth/db-pgsql.c Tue May 27 11:16:38 2003 @@ -53,9 +53,16 @@ res = PQexec(conn->pg, query); if (PQresultStatus(res) != PGRES_TUPLES_OK) { - i_error("PGSQL: Query \"%s\" failed: %s", - query, PQresultErrorMessage(res)); - failed = TRUE; + PQreset(conn->pg); + res = PQexec(conn->pg, query); + if (PQresultStatus(res) != PGRES_TUPLES_OK) { + i_error("PGSQL: Query \"%s\" failed: %s", + query, PQresultErrorMessage(res)); + failed = TRUE; + } else { + i_error("PGSQL: Reconnected because of failure!"); + failed = FALSE; + } } else { failed = FALSE; } --8<-- -----Original Message----- From: Maikel Verheijen [mailto:maikel@ladot.com] Sent: Tuesday, May 27, 2003 9:43 AM To: 'Dovecot (E-mail)' Subject: [Dovecot] Postgres "issue" Dear list, I have a small issue with dovecot talking to a postgresql server: If my postgres server get restarted, dovecot fails to reconnect to the postgres server. I run dovecot 0.99.9.1 (which is actually a cvs version of dovecot, of may 9 2003) I have the same postgres version for the server as I use for the libraries. Is it hard to get auto-reconnect to work? Kind regards, Maikel Verheijen Ps: the log message I get is this: 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. Which probably describes it all :)
participants (1)
-
Maikel Verheijen