Re: pulling libpqtypes from queue - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: pulling libpqtypes from queue
Date
Msg-id 4804FE5C.2000200@esilo.com
Whole thread Raw
In response to Re: pulling libpqtypes from queue  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pulling libpqtypes from queue  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-hackers
Tom Lane wrote:
> Andrew Chernow <ac@esilo.com> writes:
>> 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.
> 
> I don't really agree with that argument; it's not impossible that you'd
> want it on some connections and not others.  The server version for
> instance could affect the choice.
> 
> Per-conn install also gets you out of a bunch of thread safety issues
> (because we've already decreed that it's the app's problem to ensure
> that only one thread touches a PGconn at a time).
> 
>             regards, tom lane
> 
> 

AFAICS, thread-safety is the big problem. I didn't really like the 
locking code either -- I was grimacing while typing the code.

Server version is handled by the fact that state is not global, only the 
hook callbacks are.  If you don't use a pqtypes function, there is no 
memory or performance overhead (the real overhead was added at link 
time).  An application has to toggle based on PQserverVersion, to 
install or not install the pqtypes objhooks.  Although, more toggling is 
needed to choose PQgetvalue over PQgetf for instance.

But, the community has held their ground on using hooks.  We tried to 
sell our stubs idea but no one was buying.  So, per-conn hooks it is.

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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pulling libpqtypes from queue
Next
From: "Merlin Moncure"
Date:
Subject: Re: pulling libpqtypes from queue