diff options
-rw-r--r-- | doc/doc-txt/ChangeLog | 6 | ||||
-rw-r--r-- | src/src/lookups/pgsql.c | 30 |
2 files changed, 34 insertions, 2 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index fc78884fd..d3535f719 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.377 2006/07/14 14:32:08 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.378 2006/07/14 14:42:57 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -114,6 +114,10 @@ PH/19 Added PQsetClientEncoding(conn, "SQL_ASCII") to the pgsql code module. PH/20 Perl can change the locale. Exim was resetting it after a ${perl call, but not after initializing Perl. +PH/21 Added a call to PQsetNoticeProcessor() to catch pgsql "notices" and + output them only if debugging. By default they are written stderr, + apparently, which is not desirable. + Exim version 4.62 ----------------- diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c index 8b777f40b..9c0c647c0 100644 --- a/src/src/lookups/pgsql.c +++ b/src/src/lookups/pgsql.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.6 2006/07/14 14:21:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.7 2006/07/14 14:42:57 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -76,6 +76,28 @@ while ((cn = pgsql_connections) != NULL) } +/************************************************* +* Notice processor function for pgsql * +*************************************************/ + +/* This function is passed to pgsql below, and called for any PostgreSQL +"notices". By default they are written to stderr, which is undesirable. + +Arguments: + arg an opaque user cookie (not used) + message the notice + +Returns: nothing +*/ + +static void +notice_processor(void *arg, const char *message) +{ +arg = arg; /* Keep compiler happy */ +DEBUG(D_lookup) debug_printf("PGSQL: %s\n", message); +} + + /************************************************* * Internal search function * @@ -253,6 +275,12 @@ if (cn == NULL) PQsetClientEncoding(pg_conn, "SQL_ASCII"); + /* Set the notice processor to prevent notices from being written to stderr + (which is what the default does). Our function (above) just produces debug + output. */ + + PQsetNoticeProcessor(pg_conn, notice_processor, NULL); + /* Add the connection to the cache */ cn = store_get(sizeof(pgsql_connection)); |