Re: libpq patch for pqtypes hook api and PGresult creation

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: libpq patch for pqtypes hook api and PGresult creation
Date: 2008-04-12 13:37:24
Message-ID: 4800BB14.8050505@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

>
> Should the hook only be called when the conn or result was
> successfull or should the hooks be called for failed
> connections/commands as well?
>

ISTM that the hooks should be called on success and error (doesn't
include cases where a NULL conn or result is returned). I think this
makes things more useful. If the hooker (pun intended) isn't interested
in error results or conns, it can easily ignore them.

connCreate: The best solution I found was to hook into PQconnectPoll.
This required making the current PQconnectPoll a static named
connectPoll and making PQconnectPoll a wrapper to it. The wrapper just
calls connectPoll and checks the status for hook points.

resultCreate: PQgetResult seemed like the best place. I only notify the
hooks if the resultStatus is NOT copyin or copyout.

I diff'd fe-connect.c and fe-exec.c against cvs which shows these changes.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

Attachment Content-Type Size
createhooks.diff text/plain 11.8 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-04-12 14:04:09 Re: [HACKERS] Terminating a backend
Previous Message Andrew Chernow 2008-04-12 12:12:29 Re: libpq patch for pqtypes hook api and PGresult creation