Re: pulling libpqtypes from queue

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, tomas(at)tuxteam(dot)de, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pulling libpqtypes from queue
Date: 2008-04-15 17:54:42
Message-ID: 4804EBE2.7030905@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure wrote:
>
> For posterity, here are our objections to hooking libpq:
> *) Is there any other plausible scenario of another use for hooking
> into libpq events? (this is rhetorical...we don't think there is.) We
> think that there is a better way to integrate libpqtypes with libpq so
> maybe the abstraction is unnecessary.
> *) keeping PQparamExec & friends outside of libpq makes error handling
> a little awkward...we expect to use TLS errors in libpqtypes (which,
> quite frankly, I wish libpq used) but think it would be cleaner to
> handle errors in consistent fashion with libpq...libpqtypes adds
> PQseterror, PQgeterror.
> *) We especially don't like having to explicitly install into every
> PGconn (PQaddObjectHooks). So, an app that wants to be ported to
> using PQgetf for example, needs to locate and inject code into all
> places connections are made, rather than just inject the call. We
> would rather have things just 'work'.
> *) In the event pqtypes becomes popular, will it remain a hooked
> library forever? If not (a tighter integration that we are advocating
> takes place), then we are stuck with the 'hook' api functions forever,
> unless this happens before 8.4 gets out.
>
> merlin
>
>

Installing it per-conn doesn't get you anything. pqtypes has already
been linked in. If you use PQexec and PQgetvalue, the pqtypes code
pretty much does nothing. So, a per-conn install seems redundant. You
are installing the same function pointers under the same name over and
over. If you link with, it should just be available.

#include <libpqtypes.h>
// library-wide init
PQtypesInit(void);
// libpqtypes is ready for use on any conn

That is what we would prefer. We tried to do it with a global array and
a lock, but that has its own problems (namely, all the locking).

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-15 18:22:31 Re: Re: [COMMITTERS] pgsql: Add pg_terminate_backend() to allow terminating only a single
Previous Message Merlin Moncure 2008-04-15 17:42:59 Re: pulling libpqtypes from queue