Re: libpq on the server - Mailing list pgsql-general

From Wayne Fang
Subject Re: libpq on the server
Date
Msg-id 6.1.2.0.0.20040823121605.02eb62a0@marilyn.barrodale.com
Whole thread Raw
In response to Re: libpq on the server  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: libpq on the server  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: libpq on the server  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
Thanks for the reply.

At 12:10 PM 8/23/04, Tom Lane wrote:
>Wayne Fang <wayne@barrodale.com> writes:
>> For various reasons (parallel structure with existing code,
>> commonality of concepts, etc), we have C language functions
>> implemented that use libpq to make a new connection to the same
>> Postgres server.  Yes, I realize libpq is meant for clients and SPI
>> for backends.  The question is, are there any technical problems with
>> this?  Will using libpq in the backend do Bad Things in unexpected
>> areas/ways?
>
>dblink does that, and I've not heard of problems, though there are
>certain specific areas where you'd need to be careful due to overlap of
>symbols between libpq and backend (the DLxxx functions used for
>listen/notify are one such place, and there are conflicts in the
>pg_wchar stuff as well).  It'd be a good idea to make sure that your
>custom functions will bind first to libpq and only second to the main
>backend's symbols.

I haven't run into any symbol conflicts, so this shouldn't be a problem,
but I'll keep this around if it does come up.

>
>By the same token, don't try to link libpq statically into the backend.
>But it should be possible to make it work as a dynamic link.
>
>Realize also that this is *fundamentally* different from SPI, in that
>you are controlling a separate session rather than issuing commands in
>your own session.  This has implications for data visibility, error
>recovery, and so on.  But you probably knew that already.

Yes I did, but confirmation is always good.
There is a possible issue of libpq requiring a new backend process,
but the overall performance impact needs more thorough testing.
In theory, the size of information and amount of processing we deal
with will help hide the overhead involved.


As another consideration, SPI doesn't yet support transactions.  Any idea
when this support might come about?

Thanks,
Wayne


pgsql-general by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions
Next
From: Tom Lane
Date:
Subject: Re: libpq on the server