Thread: postgres libpq library

postgres libpq library

From
Massimo Pichini
Date:
Hi all,

I guess that the postgres it-self is not designated as a multi-threaded
server. I was wondering if the library is instead thread safe (i.e.: if
it can be safely called from multi-threaded applications).

Thanks in advance
Massimo

Re: [GENERAL] postgres libpq library

From
Peter Eisentraut
Date:
On Wed, 1 Dec 1999, Massimo Pichini wrote:

> I guess that the postgres it-self is not designated as a multi-threaded
> server. I was wondering if the library is instead thread safe (i.e.: if
> it can be safely called from multi-threaded applications).

That's a definite no.

I'm not even sure if there is a chance of cleaning that up in finite time,
after all many C libraries are not very thread-safe either.

Perhaps this CORBA stuff that has been thrown around lately can help
there, but that's merely in the proposal stage right now.

--
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Re: [GENERAL] postgres libpq library

From
^chewie
Date:
On Thu, 2 Dec 1999, Peter Eisentraut wrote:

> > I guess that the postgres it-self is not designated as a multi-threaded
> > server. I was wondering if the library is instead thread safe (i.e.:
> > if it can be safely called from multi-threaded applications).
>
> That's a definite no.
>
> I'm not even sure if there is a chance of cleaning that up in finite
> time, after all many C libraries are not very thread-safe either.
>
> Perhaps this CORBA stuff that has been thrown around lately can help
> there, but that's merely in the proposal stage right now.

You know.  I, for one, have a little bit of free time I could donate to
contributing to the Postgresql project.  I know C and would not mind
learning how to implement POSIX threading.  Like any project, it needs
to start somewhere with someone.  I suppose I should join the [HACKERS]
list, then, huh? ;-)

^chewie <chewie@wookimus.net>


Re: [GENERAL] postgres libpq library

From
Peter Eisentraut
Date:
On 1999-12-02, ^chewie mentioned:

> > > server. I was wondering if the library is instead thread safe (i.e.:
> > > if it can be safely called from multi-threaded applications).
> >
> > That's a definite no.
>
> You know.  I, for one, have a little bit of free time I could donate to
> contributing to the Postgresql project.  I know C and would not mind
> learning how to implement POSIX threading.  Like any project, it needs
> to start somewhere with someone.  I suppose I should join the [HACKERS]
> list, then, huh? ;-)

Although to my knowledge, there haven't been a lot of complaints regarding
the thread-safeness of libpq, you are sure welcome to try. Note that this
would (probably) not involve any thread programming though.

The main difficulty would seem to center around the fact that all network
transmission is done as strings and you need a bunch of different buffers
to convert those back and forth and a lot of care needs to be exercised
there. I'm personally not sure if it's worth it or even possible using the
current protocols.

If you do want to contribute, however, joining that hackers list and
reading the TODO list would be excellent starts. There is probably a lot
of stuff in libpq that could be taken care of anyway.

    -Peter

--
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden