Re: [Patch proposal] libpq portal support

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Sergei Fedorov <sergei(dot)a(dot)fedorov(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Patch proposal] libpq portal support
Date: 2019-11-08 06:14:35
Message-ID: CAMsr+YEEOaQH5+xCcf9G-KozJ3CKtLtj=i8-YZmDfXgumJb1Zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 7 Nov 2019 at 17:43, Sergei Fedorov <sergei(dot)a(dot)fedorov(at)gmail(dot)com>
wrote:

> Hello everybody,
>
> Yes, we will be happy to put our patch under the PostgreSQL License.
>
> Patch is attached to this email, master was rebased to head prior to
> creating the patch.
>
> We are using a C++ wrapper on top of libpq for using database connections
> in multithreaded asynchronous applications. For security reasons (and
> partially because we are too lazy to escape query parameters) we use
> prepared queries and parameter binding for execution. There are situations
> when we need to fetch the query results not in one batch but in a `paged`
> way, the most convenient way is to use the portals feature of PosgreSQL
> protocol.
>
>
By way of initial patch review: there's a lot of copy/paste here that
should be avoided if possible. It looks like the added function
PQsendPortalBindParams() is heavily based on PQsendQueryGuts(), which is
the common implementation shared by the existing PQsendQueryParams()
and PQsendQueryPrepared() .

Similar for PQsendPortalExecute().

I'd like to see the common code factored out, perhaps by adding the needed
functionality into PQsendQueryGuts() etc.

The patch is also missing documentation; please add it
to doc/src/sgml/libpq.sgml in docbook XML format. See the existing function
examples.

I'd ask you to add test cover, but we don't really have a useful test suite
for libpq yet, so there's not much you can do there. It definitely won't
fly without the docs and copy/paste reduction though.

--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2019-11-08 06:16:28 Re: TestLib::command_fails_like enhancement
Previous Message Yuya Watari 2019-11-08 05:58:33 Re: Keep compiler silence (clang 10, implicit conversion from 'long' to 'double' )