Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 731CC2E002D for ; Thu, 15 May 2008 13:09:48 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 17423-04 for ; Thu, 15 May 2008 13:09:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id A81112E0047 for ; Thu, 15 May 2008 13:09:41 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m4FG9VKM006045; Thu, 15 May 2008 12:09:31 -0400 (EDT) To: "Merlin Moncure" cc: "Andrew Dunstan" , "Alvaro Herrera" , "Patches (PostgreSQL)" , "Andrew Chernow" Subject: Re: libpq object hooks In-reply-to: References: <482A58D8.2030205@dunslane.net> <20080514043313.GS6966@alvh.no-ip.org> <482AD896.4000504@dunslane.net> <19342.1210776271@sss.pgh.pa.us> Comments: In-reply-to "Merlin Moncure" message dated "Thu, 15 May 2008 11:52:21 -0400" Date: Thu, 15 May 2008 12:09:31 -0400 Message-ID: <6044.1210867771@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/276 X-Sequence-Number: 6302 "Merlin Moncure" writes: > The problem is the functions PQhookData(conn, hookname) and > PQresultHookData(result, hookName). We need these to work in > functions that are not callbacks. If we eliminate hookname > completely, there is no way for libpq to know which private state we > are asking for. Well, depending on a hook name for this is broken-by-design anyway, because there is no way for two independently written libraries to be sure they don't choose conflicting hook names. So the need for a hook name has to go away. It might work to use the address of the hook callback function as a key for retrieving the associated void * pointer. You'd need to not register the same callback function more than once per object, but from what I gather here you don't need to. regards, tom lane