X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8A163D1E825 for ; Mon, 19 Jan 2004 02:41:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 94730-03 for ; Sun, 18 Jan 2004 22:40:42 -0400 (AST) Received: from smtp10.atl.mindspring.net (smtp10.atl.mindspring.net [207.69.200.246]) by svr1.postgresql.org (Postfix) with ESMTP id 7FCF2D1E802 for ; Sun, 18 Jan 2004 22:40:38 -0400 (AST) Received: from sdn-ap-001njpennp0105.dialsprint.net ([63.185.128.105] helo=mindspring.com) by smtp10.atl.mindspring.net with esmtp (Exim 3.33 #1) id 1AiPL7-0002Cj-00; Sun, 18 Jan 2004 21:40:34 -0500 Received: (from lbayuk@localhost) by mindspring.com (8.12.10/8.12.10) id i0J2cUwB000262; Sun, 18 Jan 2004 21:38:30 -0500 From: L J Bayuk Message-Id: <200401190238.i0J2cUwB000262@mindspring.com> Subject: Re: PQsetNoticeReceiver issues To: peter_e@gmx.net (Peter Eisentraut) Date: Sun, 18 Jan 2004 21:38:30 -0500 (EST) Cc: jgardner@jonathangardner.net (Jonathan Gardner), pgsql-interfaces@postgresql.org In-Reply-To: <200401181119.58577.peter_e@gmx.net> from "Peter Eisentraut" at Jan 18, 2004 11:19:58 AM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/11 X-Sequence-Number: 4680 Peter Eisentraut wrote: > > Jonathan Gardner wrote: > > I've run into a conundrum with the PQsetNoticeReceiver function call. > > How do you set it back to the original default? How do you call the > > appropriate PQnoticeProcessor as well? > > The documentation says: > > Each of these functions returns the previous notice receiver or > processor function pointer, and sets the new value. If you supply a > null function pointer, no action is taken, but the current pointer is > returned. Saving and restoring the previous noticeProcessor or noticeReceiver handler function works, unless they actually made use of the "arg" pass-through argument. For example, somewhere you have: PQsetNoticeProcessor(conn, myNoticeProc, &mydata); And somewhere else you want to temporarily override the noticeProcessor: prevNoticeProc = PQsetNoticeProcessor(conn, newNoticeProc, &newdata); /* ... Do something which makes a notice ... */ /* Restore previous notice processor */ PQsetNoticeProcessor(conn, prevNoticeProc, ????); /* Oops, lost the previous "arg". */ Not exactly a huge API hole, but nevertheless...