X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/35d40a980556bac0460dc027a44fb5285cda3364..034d99ab7d8d4bf671671e583c32cf7dd322c1c2:/src/src/lookups/pgsql.c 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));