Re: [Patch proposal] libpq portal support

From: Sergei Fedorov <sergei(dot)a(dot)fedorov(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Patch proposal] libpq portal support
Date: 2019-11-07 09:43:23
Message-ID: CAENDX4KxFRxKDFb+U8jApW7=zRSHsLFhTNKtTrwQGhJ7QCkSww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

пт, 18 окт. 2019 г. в 15:21, Craig Ringer <craig(at)2ndquadrant(dot)com>:

> On Thu, 17 Oct 2019 at 03:12, Sergei Fedorov <sergei(dot)a(dot)fedorov(at)gmail(dot)com>
> wrote:
>
>> Hello everybody,
>>
>> Our company was in desperate need of portals in async interface of libpq,
>> so we patched it.
>>
>> We would be happy to upstream the changes.
>>
>> The description of changes:
>>
>> Two functions in libpq-fe.h:
>> PQsendPortalBindParams for sending a command to bind a portal to a
>> previously prepared statement;
>> PQsendPortalExecute for executing a previously bound portal with a given
>> number of rows.
>>
>> A patch to pqParseInput3 in fe-protocol3.c to handle the `portal
>> suspended` message tag.
>>
>> The patch is ready for review, but it lacks documentation, tests and
>> usage examples.
>>
>> There are no functions for sending bind without params and no functions
>> for sync interface, but they can easily be added to the feature.
>>
>
> If you are happy to put it under The PostgreSQL License, then sending it
> as an attachment here is the first step.
>
> If possible, please rebase it on top of git master.
>
> Some explanation for why you have this need and what problems this solves
> for you would be helpful as well.
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> 2ndQuadrant - PostgreSQL Solutions for the Enterprise
>

--
Thank you,
Sergei Fedorov

Attachment Content-Type Size
libpq-portals.patch application/octet-stream 7.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-11-07 09:49:45 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Etsuro Fujita 2019-11-07 09:40:36 Re: [PATCH][DOC] Fix for PREPARE TRANSACTION doc and postgres_fdw message.